#include <bits/stdc++.h>
using namespace std;
const long long INF = 5e18;
long long gcd(long long a, long long b) {
  if (a == 0) return b;
  return gcd(b % a, a);
}
void solve() {
  long long n, m;
  cin >> n >> m;
  long long a[n + 1];
  long long pref[n + 2];
  long long suf[n + 2];
  memset(pref, 0, sizeof(pref)), memset(suf, 0, sizeof(suf));
  long long ans = 0;
  for (long long i = 1; i < n + 1; i++) {
    cin >> a[i];
    pref[i] = pref[i - 1] + a[i];
    if (pref[i] < 0) pref[i] = 0;
    ans = max(ans, max(pref[i] * m, pref[i]));
  }
  for (long long i = n; i >= 1; i--) {
    suf[i] = suf[i + 1] + a[i];
    if (suf[i] < 0) suf[i] = 0;
  }
  long long pre = 0;
  long long curr = 0;
  curr = 0;
  for (long long i = 1; i < n + 1; i++) {
    curr += a[i];
    if (curr <= 0) {
      if (!pre) {
        pre = i;
        curr = a[i];
      }
      ans = max(ans, curr * m + suf[i + 1] + pref[pre - 1]);
      if (pref[i] >= curr * m + pref[pre - 1]) {
        pre = 0;
        curr = 0;
      }
    } else if (curr >= 0) {
      pre = 0;
      curr = 0;
    }
  }
  cout << ans << endl;
}
signed main() {
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(20);
  cin.tie(0);
  cout.tie(0);
  long long t = 1;
  while (t--) {
    solve();
  }
}
