#include <bits/stdc++.h>
using namespace std;
const long long MAX = 1000;
const long long MAXN = 1000;
const double PI = acos(-1.0);
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
long long x, dp[3][300010], ans = 0;
int main() {
  int n, m;
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    cin >> x;
    dp[0][i + 1] = max(0ll, dp[0][i]) + x;
    dp[1][i + 1] = max(0ll, max(dp[0][i], dp[1][i])) + x * m;
    ;
    dp[2][i + 1] = max(0ll, max(dp[1][i], dp[2][i])) + x;
    ans = max(ans, max(dp[0][i + 1], max(dp[1][i + 1], dp[2][i + 1])));
  }
  cout << ans << endl;
  return 0;
}
