#include <bits/stdc++.h>
using namespace std;
inline long long read() {
  long long sum = 0, ff = 1;
  char ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') ff = -1;
    ch = getchar();
  }
  while (isdigit(ch)) sum = sum * 10 + (ch ^ 48), ch = getchar();
  return sum * ff;
}
const long long N = 3e5 + 5;
long long n, m, a, b, c, x, ans;
signed main() {
  n = read();
  m = read();
  for (long long i = 1; i <= n; i++) {
    long long x = read();
    long long lasa = a;
    a = max(a + x, 0ll);
    c = max(c + x, b + x);
    b = max(b + x * m, lasa + x * m);
    ans = max(c, max(ans, max(a, b)));
  }
  printf("%lld\n", ans);
  return 0;
}
