#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  int n, x;
  cin >> n >> x;
  long long a[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  long long pref[n];
  pref[0] = a[0];
  for (int i = 1; i < n; i++) {
    pref[i] = pref[i - 1] + a[i];
  }
  long long bestBef[n];
  long long bestAft[n];
  long long currLow = 0;
  for (int i = 0; i < n; i++) {
    bestBef[i] = max((long long)0, pref[i] - currLow);
    currLow = min(currLow, pref[i]);
  }
  long long currHigh = pref[n - 1];
  for (int i = n - 1; i >= 0; i--) {
    bestAft[i] = max((long long)0, currHigh - pref[i]);
    currHigh = max(currHigh, pref[i]);
  }
  for (int i = 0; i < n; i++) {
    bestBef[i] -= x * pref[i];
    bestAft[i] += x * pref[i];
  }
  long long res = 0;
  long long bestInit = 0;
  for (int i = 0; i < n; i++) {
    bestInit = max(bestInit, bestBef[i]);
    res = max(res, bestAft[i] + bestInit);
  }
  cout << res;
}
