#include <bits/stdc++.h>
using namespace std;
long long N, K, a[300005], b[300005];
long long ans, dp[300005][2][2];
int main() {
  cin >> N >> K;
  for (int i = 0; i < N; i++) {
    cin >> a[i];
    b[i] = K * a[i];
  }
  ans = max(0LL, max(a[0], b[0]));
  dp[0][0][0] = dp[0][1][0] = a[0];
  dp[0][0][1] = dp[0][1][1] = b[0];
  for (int i = 1; i < N; i++) {
    dp[i][0][0] = max(0LL, dp[i - 1][0][0]) + a[i];
    dp[i][0][1] = max(0LL, dp[i - 1][0][1]) + b[i];
    dp[i][1][0] = max(0LL, max(dp[i - 1][1][0], dp[i - 1][1][1])) + a[i];
    dp[i][1][1] = max(0LL, max(dp[i - 1][0][0], dp[i - 1][1][1])) + b[i];
    ans = max(
        ans, max(dp[i][0][0], max(dp[i][0][1], max(dp[i][1][0], dp[i][1][1]))));
  }
  cout << ans << endl;
}
