#include <bits/stdc++.h>
using namespace std;
long long int dp[300005][3];
int main() {
  int n, k;
  cin >> n >> k;
  long long int x;
  long long int ans = -1e10;
  for (int i = 1; i <= n; i++) {
    cin >> x;
    dp[i][0] = max(dp[i - 1][0] + x, 0LL);
    dp[i][1] = max(dp[i - 1][1] + k * x, dp[i][0]);
    dp[i][2] = max(dp[i - 1][2] + x, dp[i][1]);
    ans = max(ans, dp[i][2]);
  }
  cout << ans;
}
