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