#include #include #include using namespace std; typedef long long ll; const int maxn = 1000 + 10; int n , P; ll process(int a[] , int p) { int tmp = a[p]; ll s = 0 , res = -2147483647; a[p] = P; for(int i = 0; i < n; i++) { s = max(0LL , s) + a[i]; res = max(res , s); } a[p] = tmp; return res; } int a[maxn]; int main() { int T; scanf("%d",&T); while(T--) { scanf("%d%d",&n,&P); for(int i = 0; i < n; i++) scanf("%d",&a[i]); ll ans = -2147483647; for(int i = 0; i < n; i++) ans = max(ans , process(a , i)); printf("%I64d\n",ans); } return 0; }