#include <bits/stdc++.h>
using namespace std;
const int N = 3e5 + 100;
const int mod = 1e9 + 7;
const long long inf = 1e18;
long long a1[N], a2[N], n, x, dp[N][3];
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> n >> x;
  for (long long i = 1; i <= n; i++) {
    cin >> a1[i];
    a2[i] = a1[i] * x;
  }
  for (long long i = 1; i <= n; i++) dp[i][0] = dp[i][1] = dp[i][2] = 0;
  dp[1][0] = a1[1];
  dp[1][1] = a2[1];
  dp[1][2] = a1[1];
  long long ans = 0;
  ans = max(dp[1][0], dp[1][1]);
  for (long long i = 2; i <= n; i++) {
    dp[i][0] = max(dp[i - 1][0], (long long)0) + a1[i];
    dp[i][1] = max(max(dp[i - 1][0], dp[i - 1][1]), (long long)0) + a2[i];
    dp[i][2] =
        max(max(dp[i - 1][1], (long long)0), max(dp[i - 1][0], dp[i - 1][2])) +
        a1[i];
    ans = max(max(ans, dp[i][0]), max(dp[i][1], dp[i][2]));
  }
  ans = max(ans, (long long)0);
  cout << ans;
}
