#include <bits/stdc++.h>
using namespace std;
const int MAXN = 3e5 + 5;
long long n, x, a[MAXN], sum[MAXN], sum2[MAXN], suml[MAXN], sumr[MAXN], ans,
    suml2[MAXN], sumr2[MAXN], sum3[MAXN], rsum[MAXN], sumbhl[MAXN];
void init() {
  memset(suml, 0, sizeof(suml));
  memset(sumr, 0, sizeof(sumr));
  memset(suml2, 0, sizeof(suml2));
  memset(sumr2, 0, sizeof(sumr2));
}
long long calc() {
  init();
  long long ret = 0, pre = 0;
  for (long long i = 1; i <= n; i++) {
    sum[i] = sum[i - 1] + a[i];
  }
  for (long long i = 1; i <= n; i++) {
    sumbhl[i] = max(0ll, sum[i] + pre);
    pre = max(pre, -sum[i]);
  }
  suml[1] = sum[1];
  for (long long i = 2; i <= n; i++) {
    suml[i] = min(sum[i], suml[i - 1]);
  }
  sumr[n] = sum[n];
  for (long long i = n - 1; i >= 1; i--) {
    sumr[i] = max(sum[i], sumr[i + 1]);
  }
  for (long long i = 1; i <= n; i++) {
    long long tem;
    if (i == n) {
      tem = (sum[i] - min(0ll, suml[i - 1]));
    } else {
      tem = (sum[i] - min(0ll, suml[i - 1])) + max(0ll, (sumr[i + 1] - sum[i]));
    }
    ret = max(ret, tem);
  }
  return ret;
}
void solve() {
  ans = calc();
  long long det = 0, pre = 0;
  for (long long i = 1; i <= n; i++) {
    long long tem;
    if (i == n) {
      tem = x * sum[i] + pre;
    } else {
      tem = x * sum[i] + pre + max(0ll, (sumr[i + 1] - sum[i]));
    }
    ans = max(ans, tem);
    pre = max(pre, (-x) * sum[i] + sumbhl[i]);
  }
  printf("%lld\n", max(0ll, ans));
}
int main() {
  while (~scanf("%lld %lld", &n, &x)) {
    for (long long i = 1; i <= n; i++) {
      scanf("%lld", &a[i]);
    }
    solve();
  }
}
