#include <bits/stdc++.h>
using namespace std;
const int maxn = 3e5 + 10;
int n, x;
long long arr[maxn], ans1[maxn], ans2[maxn], ans3[maxn];
int main(int argc, char const *argv[]) {
  scanf("%d %d", &n, &x);
  for (int i = 0; i < n; ++i) {
    scanf("%lld", &arr[i]);
  }
  long long ans = 0;
  for (int i = 0; i < n; ++i) {
    if (i > 0)
      ans1[i] = arr[i] + max(ans1[i - 1], 0ll);
    else
      ans1[i] = arr[i];
    ans = max(ans, ans1[i]);
  }
  for (int i = 0; i < n; ++i) {
    if (i == 0) {
      ans2[i] = arr[i] * x;
    } else {
      long long tmp = max(ans1[i - 1], ans2[i - 1]);
      ans2[i] = arr[i] * x + max(tmp, 0ll);
    }
    ans = max(ans, ans2[i]);
  }
  if (n > 1) ans = max(ans, ans3[1] = arr[0] * x + arr[1]);
  for (int i = 2; i < n; ++i) {
    ans3[i] = arr[i] + max(ans3[i - 1], ans2[i - 1]);
    ans = max(ans, ans3[i]);
  }
  printf("%lld\n", ans);
  return 0;
}
