#include <bits/stdc++.h>
using namespace std;
const int maxn = 3e5 + 35;
long long a[maxn], x, dp[maxn][3];
int n;
int main() {
  cin >> n >> x;
  for (int i = 1; i <= n; ++i) cin >> a[i];
  long long res = 0;
  for (int i = 1; i <= n; ++i) {
    dp[i][0] = max(a[i], max(0LL, dp[i - 1][0] + a[i]));
    dp[i][1] = max(max(dp[i - 1][1] + a[i] * x, 0LL), dp[i - 1][0] + a[i] * x);
    dp[i][2] = max(0LL, max(dp[i - 1][2] + a[i], dp[i - 1][1] + a[i]));
    res = max(max(dp[i][1], max(res, dp[i][0])), dp[i][2]);
  }
  cout << res << '\n';
  return 0;
}
