#include <bits/stdc++.h>
const double eps = (1e-9);
using namespace std;
int dcmp(long double a, long double b) {
  return fabsl(a - b) <= eps ? 0 : (a > b) ? 1 : -1;
}
int getBit(int num, int idx) { return ((num >> idx) & 1) == 1; }
int setBit1(int num, int idx) { return num | (1 << idx); }
long long setBit0(long long num, int idx) { return num & ~(1ll << idx); }
long long flipBit(int num, int idx) { return num ^ (1 << idx); }
void FS() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}
const int N = 300009;
long long a[N];
long long dp[N][3][3];
int main() {
  long long n, k;
  cin >> n >> k;
  for (int i = 1; i <= n; i++) cin >> a[i];
  long long ans = 0;
  for (int i = 1; i <= n; i++) {
    dp[i][1][0] = a[i];
    dp[i][1][0] = max(dp[i][1][0], dp[i - 1][1][0] + a[i]);
    dp[i][1][2] =
        max(dp[i][1][2], max(dp[i - 1][1][1] + a[i], dp[i - 1][1][2] + a[i]));
    dp[i][1][1] = a[i] * k;
    dp[i][1][1] = max(dp[i][1][1], max(dp[i - 1][1][0] + a[i] * k,
                                       dp[i - 1][1][1] + a[i] * k));
    ans = max(ans, max(dp[i][1][2], max(dp[i][1][0], dp[i][1][1])));
  }
  cout << ans << endl;
}
