#include <bits/stdc++.h>
using namespace std;
int n;
long long x;
long long a[300100];
pair<long long, long long> dp[300100][2][2];
pair<long long, long long> f(int idx, bool mul, bool cont) {
  if (idx == n) return {0, 0};
  pair<long long, long long> &ret = dp[idx][mul][cont];
  if (~ret.first) return ret;
  if (!mul) {
    pair<long long, long long> it = f(idx + 1, 1, 1);
    it.first = max(0ll, it.first + a[idx] * x);
    it.second = max(it.second, it.first);
    ret = it;
    it = f(idx + 1, 0, 0);
    it.first = max(0ll, it.first + a[idx]);
    it.second = max(it.second, it.first);
    ret.first = max(ret.first, it.first);
    ret.second = max(ret.second, it.second);
    return ret;
  }
  if (cont) {
    pair<long long, long long> it = f(idx + 1, 1, 1);
    it.first = max(0ll, it.first + a[idx] * x);
    it.second = max(it.second, it.first);
    ret = it;
    it = f(idx + 1, 1, 0);
    it.first = max(0ll, it.first + a[idx]);
    it.second = max(it.second, it.first);
    ret.first = max(ret.first, it.first);
    ret.second = max(ret.second, it.second);
    return ret;
  }
  pair<long long, long long> it = f(idx + 1, 1, 0);
  it.first = max(0ll, it.first + a[idx]);
  it.second = max(it.second, it.first);
  ret.first = max(ret.first, it.first);
  ret.second = max(ret.second, it.second);
  return ret;
}
int main() {
  scanf("%d", &n);
  scanf("%lld", &x);
  for (int i = 0; i < n; ++i) scanf("%lld", &a[i]);
  memset(dp, -1, sizeof dp);
  printf("%lld", f(0, 0, 0).second);
  return 0;
}
