#include <bits/stdc++.h>
using namespace std;
long long a[300000 + 10], dp[300000 + 10][3];
int main(void) {
  long long n, x;
  scanf("%lld%lld", &n, &x);
  for (int i = 1; i <= n; i++) {
    scanf("%lld", &a[i]);
  }
  long long ans = 0;
  for (int i = 1; i <= n; i++) {
    dp[i][0] = max(dp[i - 1][0], 0ll) + a[i];
    dp[i][1] = max(0ll, max(dp[i - 1][0], dp[i - 1][1])) + a[i] * x;
    dp[i][2] =
        max(max(dp[i - 1][0], max(dp[i - 1][1], dp[i - 1][2])), 0ll) + a[i];
    ans = max(ans, max(max(dp[i][0], dp[i][1]), dp[i][2]));
  }
  printf("%lld\n", ans);
  return 0;
}
