#include #include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long ll; typedef double db; const db pi=acos(-1); void gn(int &x){ int sg=1;char c;while(((c=getchar())<'0'||c>'9')&&c!='-'); if(c=='-')sg=-1,x=0;else x=c-'0'; while((c=getchar())>='0'&&c<='9')x=x*10+c-'0'; x*=sg; } void gn(ll &x){ int sg=1;char c;while(((c=getchar())<'0'||c>'9')&&c!='-'); if(c=='-')sg=-1,x=0;else x=c-'0'; while((c=getchar())>='0'&&c<='9')x=x*10+c-'0'; x*=sg; } const int mo=1000000007; int qp(int a,ll b){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;} int n,p,a[1111]; ll ge(){ ll su=0; ll ma=-11111111111111ll; for (int i=1;i<=n;i++){ ma=max(ma,1ll*a[i]); } if(ma<=0)return ma; for (int i=1;i<=n;i++){ su+=a[i]; if(su<=0)su=0; ma=max(su,ma); } return ma; } int main() { int tes; scanf("%d",&tes); while(tes--){ scanf("%d%d",&n,&p); for (int i=1;i<=n;i++)scanf("%d",&a[i]); ll ma=-1111111111111111ll; for (int i=1;i<=n;i++){ int q=a[i]; a[i]=p; ma=max(ma,ge()); a[i]=q; } cout<