#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pil = pair<int, ll>;
using pli = pair<ll, int>;
using piii = pair<int, pii>;
using pib = pair<int, bool>;
using ld = long double;
struct node {
  int l, r;
  ll v;
};
int n, x;
ll psa1[300001], psa2[300001], kv[300001], jv[300001];
node st[1200000];
void b1(int l, int r, int i) {
  st[i] = {l, r, 0};
  if (l != r) {
    int mid = (l + r) / 2;
    b1(l, mid, i * 2 + 1);
    b1(mid + 1, r, i * 2 + 2);
    st[i].v = min(st[i * 2 + 1].v, st[i * 2 + 2].v);
  } else
    st[i].v = psa1[l];
}
void b2(int l, int r, int i) {
  if (l != r) {
    int mid = (l + r) / 2;
    b2(l, mid, i * 2 + 1);
    b2(mid + 1, r, i * 2 + 2);
    st[i].v = min(st[i * 2 + 1].v, st[i * 2 + 2].v);
  } else
    st[i].v = kv[l];
}
void b3(int l, int r, int i) {
  if (l != r) {
    int mid = (l + r) / 2;
    b3(l, mid, i * 2 + 1);
    b3(mid + 1, r, i * 2 + 2);
    st[i].v = max(st[i * 2 + 1].v, st[i * 2 + 2].v);
  } else
    st[i].v = jv[l];
}
ll q1(int l, int r, int i) {
  if (st[i].l >= l && st[i].r <= r) {
    return st[i].v;
  } else {
    int mid = (st[i].l + st[i].r) / 2;
    if (r <= mid)
      return q1(l, r, i * 2 + 1);
    else if (l > mid)
      return q1(l, r, i * 2 + 2);
    else {
      return min(q1(l, r, i * 2 + 1), q1(l, r, i * 2 + 2));
    }
  }
}
ll q2(int l, int r, int i) {
  if (st[i].l >= l && st[i].r <= r) {
    return st[i].v;
  } else {
    int mid = (st[i].l + st[i].r) / 2;
    if (r <= mid)
      return q2(l, r, i * 2 + 1);
    else if (l > mid)
      return q2(l, r, i * 2 + 2);
    else {
      return max(q2(l, r, i * 2 + 1), q2(l, r, i * 2 + 2));
    }
  }
}
int main() {
  cin.sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> x;
  for (int i = 1; i <= n; i++) {
    cin >> psa1[i];
    psa2[i] = psa1[i] * x + psa2[i - 1];
    psa1[i] += psa1[i - 1];
  }
  b1(0, n, 0);
  for (int i = 1; i <= n; i++) {
    kv[i] = psa2[i] - psa1[i] + q1(0, i, 0);
  }
  b2(0, n, 0);
  for (int i = 1; i <= n; i++) {
    jv[i] = psa2[i] - psa1[i] - q1(0, i, 0);
  }
  b3(0, n, 0);
  ll ans = 0;
  for (int i = 1; i <= n; i++) {
    ans = max(ans, psa1[i] + q2(0, i, 0));
  }
  cout << ans << "\n";
  return 0;
}
