#include <bits/stdc++.h>
using namespace std;
inline long long read() {
  long long s = 0, w = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') w = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') s = s * 10 + ch - '0', ch = getchar();
  return s * w;
}
void put1() { puts("YES"); }
void put2() { puts("NO"); }
const int manx = 3e5 + 5;
;
long long a[manx], dp[manx];
int main() {
  long long n, m, ans = -0x3f3f3f3f;
  n = read(), m = read();
  for (int i = 1; i <= n; i++) {
    a[i] = read();
    dp[0] = max((long long)0, dp[0] + a[i]);
    dp[1] = max(dp[0], dp[1] + a[i] * m);
    dp[2] = max(dp[1], dp[2] + a[i]);
    ans = max(ans, dp[2]);
  }
  cout << ans << endl;
  return 0;
}
