#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
const long long _64inf = 0x3f3f3f3f3f3f3f3f;
const int MAX = 3e5 + 5;
long long dp[MAX][2][2];
int main() {
  long long n, k;
  cin >> n >> k;
  vector<long long> a(n + 1);
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 1; i <= n; i++) {
    dp[i][0][1] = max({dp[i - 1][1][1], dp[i - 1][0][1], 0LL}) + a[i];
    dp[i][1][1] = max({dp[i - 1][1][1], dp[i - 1][0][0], 0LL}) + k * a[i];
    dp[i][0][0] = max(dp[i - 1][0][0] + a[i], a[i]);
  }
  long long ans = 0;
  for (int i = 1; i <= n; i++) {
    ans = max(ans, dp[i][0][0]);
    ans = max(ans, dp[i][0][1]);
    ans = max(ans, dp[i][1][1]);
  }
  cout << ans << endl;
  return 0;
}
