#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
int gcd(int A, int B) {
  if (!B) return A;
  return gcd(B, A % B);
}
long long int rg[3001000];
long long int lf[3001000];
long long int sum[3001000];
long long int a[3001000];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  long long int n, x;
  cin >> n >> x;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    sum[i] += sum[i - 1] + a[i];
    lf[i] = max(lf[i - 1] + a[i], a[i]);
    lf[i] = max(lf[i], 0LL);
  }
  for (int i = n; i >= 1; i--) {
    rg[i] = max(rg[i + 1] + a[i], a[i]);
    rg[i] = max(rg[i], 0LL);
  }
  long long int mx = 0;
  long long int ans = 0;
  for (int i = 0; i <= n; i++) {
    ans = max(ans, x * sum[i] + rg[i + 1] + mx);
    mx = max(mx, lf[i] - x * sum[i]);
  }
  cout << ans;
}
