#include <bits/stdc++.h>
using namespace std;
const int N = 300010;
int a[N];
long long dp[N][2], f[N][2];
long long sum[N];
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    sum[i] = sum[i - 1] + a[i];
  }
  long long ans = 0;
  if (m > 0) {
    long long tmp = 0;
    for (int i = 1; i <= n; i++) {
      tmp += a[i];
      if (tmp < 0) tmp = 0;
      ans = max(ans, tmp * m);
    }
    cout << ans << endl;
    return 0;
  }
  if (m == 0) {
    for (int i = 1; i <= n; i++) {
      dp[i][1] = max(a[i] * 1LL, dp[i - 1][1] + a[i]);
      dp[i][0] = max(dp[i - 1][0], max(0LL, dp[i - 1][1]));
    }
    for (int i = n; i >= 1; i--) {
      f[i][1] = max(a[i] * 1LL, f[i + 1][1] + a[i]);
      f[i][0] = max(f[i + 1][0], max(0LL, f[i + 1][1]));
    }
    for (int i = 1; i <= n; i++) {
      ans = max(ans, max(dp[i][0], dp[i][1]) + max(f[i + 1][0], f[i + 1][1]));
      ans = max(ans, max(f[i][0], f[i][1]) + max(dp[i - 1][0], dp[i - 1][1]));
    }
    cout << ans << endl;
    return 0;
  }
  for (int i = 1; i <= n; i++) {
    dp[i][1] = max(a[i] * 1LL, dp[i - 1][1] + a[i]);
    dp[i][0] = max(dp[i - 1][0], max(0LL, dp[i - 1][1]));
  }
  for (int i = n; i >= 1; i--) {
    f[i][1] = max(a[i] * 1LL, f[i + 1][1] + a[i]);
    f[i][0] = max(f[i + 1][0], max(0LL, f[i + 1][1]));
  }
  ans = max(f[1][0], f[1][1]);
  long long mx = 0;
  for (int i = 1; i <= n; i++) {
    ans = max(ans, mx + m * sum[i] + max(0LL, f[i + 1][1]));
    mx = max(mx, -m * sum[i] + max(0LL, dp[i][1]));
  }
  cout << ans << endl;
  return 0;
}
