#include <bits/stdc++.h>
using namespace std;
long long power(long long x, long long y, long long p) {
  long long res = 1;
  x = x % p;
  while (y > 0) {
    if (y & 1) res = (res * x) % p;
    y = y >> 1;
    x = (x * x) % p;
  }
  return res;
}
long long a[300050] = {0};
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long t, i, j, n, m, k, q, temp, x, y;
  {
    long long ans = 0, end_curr = 0, start_curr = 0, curr_curr = 0, max_pos = 0,
              max_neg = 0;
    long long count = 0;
    bool flag = 0;
    string s;
    cin >> n >> x;
    for (int i = 0; i < n; i++) {
      cin >> a[i];
    }
    for (int i = 0; i < n; i++) {
      end_curr = max(end_curr + a[i], curr_curr + a[i]);
      curr_curr = max(curr_curr + x * a[i], start_curr + x * a[i]);
      start_curr += a[i];
      if (a[i] > end_curr) {
        end_curr = a[i];
      }
      if (a[i] > start_curr) {
        start_curr = a[i];
      }
      if (a[i] * x > curr_curr) {
        curr_curr = a[i] * x;
      }
      ans = max(max(max(curr_curr, start_curr), end_curr), ans);
    }
    cout << ans << endl;
  }
  return 0;
}
