#include <bits/stdc++.h>
using namespace std;
template <typename T1, typename T2>
inline void chmin(T1& a, T2 b) {
  if (a > b) a = b;
}
template <typename T1, typename T2>
inline void chmax(T1& a, T2 b) {
  if (a < b) a = b;
}
const long long MOD = 1e9 + 7;
const long long MAX = 200060;
const double pi = acos(-1);
const double EPS = 1e-12;
const long long INF = 1e18;
long long dp[300030][5];
void solve() {
  long long N, X;
  cin >> N >> X;
  vector<long long> A(N);
  for (long long i = 0; i < N; i++) cin >> A[i];
  if (X > 0) {
    long long ans = 0;
    for (long long i = 0; i < N; i++) {
      dp[i + 1][0] = 0;
      dp[i + 1][1] = max(dp[i][0] + X * A[i], dp[i][1] + X * A[i]);
      dp[i + 1][2] = max(dp[i][1], dp[i][2]);
      ans = max({ans, dp[i + 1][0], dp[i + 1][1], dp[i + 1][2]});
    }
    cout << ans << '\n';
  } else {
    long long ans = 0;
    for (long long i = 0; i < N; i++) {
      dp[i + 1][0] = 0;
      dp[i + 1][1] = max(dp[i][0] + A[i], dp[i][1] + A[i]);
      dp[i + 1][2] = max(dp[i][1] + X * A[i], dp[i][2] + X * A[i]);
      dp[i + 1][3] = max(dp[i][2] + A[i], dp[i][3] + A[i]);
      dp[i + 1][4] = max(dp[i][3], dp[i][4]);
      ans = max({ans, dp[i + 1][1], dp[i + 1][2], dp[i + 1][3], dp[i + 1][4]});
    }
    cout << ans << '\n';
  }
}
signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  solve();
}
