#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long n, k;
  cin >> n >> k;
  long long dp[n + 1][3];
  memset(dp, 0, sizeof(dp));
  long long ans = 0;
  for (long long i = 1; i <= n; i++) {
    long long x;
    cin >> x;
    long long maxi;
    dp[i][0] = max((long long)0, dp[i - 1][0] + x);
    dp[i][1] = max(dp[i - 1][0], dp[i - 1][1]) + k * x;
    dp[i][2] = max(dp[i - 1][2], dp[i - 1][1]) + x;
    ;
    maxi = max(dp[i][0], max(dp[i][1], dp[i][2]));
    ans = max(maxi, ans);
  }
  cout << ans << "\n";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ;
  long long t;
  t = 1;
  while (t--) solve();
  return 0;
}
