#include <bits/stdc++.h>
using namespace std;
const int maxn = 3e5 + 10;
long long a[maxn], dp[maxn][3];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  long long x;
  cin >> n >> x;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  dp[n - 1][0] = max(1ll * 0, a[n - 1]);
  dp[n - 1][1] = max(1ll * 0, a[n - 1] * x);
  dp[n - 1][2] = max(1ll * 0, a[n - 1]);
  for (int i = n - 2; i >= 0; i--) {
    dp[i][0] = max(1ll * 0, a[i] + dp[i + 1][0]);
    dp[i][1] =
        max(1ll * 0, max(a[i] * x + dp[i + 1][0], a[i] * x + dp[i + 1][1]));
    dp[i][2] = max(1ll * 0, max(a[i] + dp[i + 1][1], a[i] + dp[i + 1][2]));
  }
  long long mx = 0;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < 3; j++) {
      mx = max(mx, dp[i][j]);
    }
  }
  cout << mx;
}
