#include <bits/stdc++.h>
using namespace std;
int n;
long long x;
int main() {
  std::ios::sync_with_stdio(false);
  cin.tie(NULL);
  int T = 1;
  for (int tc = 1; tc <= T; tc++) {
    cin >> n >> x;
    vector<long long> a(n);
    vector<vector<long long> > dp(n + 1, vector<long long>(5, 0));
    for (int i = 0; i < n; i++) {
      cin >> a[i];
    }
    dp[0][0] = max(0LL, a[0]);
    dp[0][1] = max(0LL, a[0] * x);
    dp[0][2] = 0;
    long long ans = max(dp[0][0], max(dp[0][1], dp[0][2]));
    for (int i = 1; i < n; i++) {
      dp[i][0] = max(0LL, dp[i - 1][0] + a[i]);
      dp[i][1] =
          max(0LL, max(dp[i - 1][1] + x * a[i], dp[i - 1][0] + x * a[i]));
      dp[i][2] = max(0LL, max(dp[i - 1][1] + a[i], dp[i - 1][2] + a[i]));
      long long temp = max(dp[i][0], max(dp[i][1], dp[i][2]));
      ans = max(ans, temp);
    }
    cout << ans << "\n";
  }
  return 0;
}
