#include <bits/stdc++.h>
using namespace std;
const int N = 4e5;
long long a[N], pre[N], used[N];
int main() {
  ios_base::sync_with_stdio(0);
  long long n, x;
  cin >> n >> x;
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 1; i <= n; i++) {
    pre[i] = max<long long>(0, a[i] + pre[i - 1]);
    used[i] = max<long long>(pre[i], (long long)a[i] * x + used[i - 1]);
  }
  long long now = 0, ans = 0;
  for (int i = n; i >= 1; i--) {
    ans = max<long long>(ans, now + used[i]);
    now = max<long long>(now + a[i], 0);
  }
  cout << ans << endl;
}
