#include <bits/stdc++.h>
using namespace std;
const int N = 3e5 + 5;
long long arr[N];
long long dp[N];
long long re_dp[N];
long long new_dp[N];
long long new_re_dp[N];
long long sum[N];
long long q[N];
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) {
    scanf("%I64d", &arr[i]);
  }
  long long ans = 0;
  dp[0] = arr[0] = 0;
  for (int i = 1; i <= n; i++) {
    dp[i] = max(dp[i - 1] + arr[i], arr[i]);
    if (dp[i] < 0) dp[i] = 0;
    ans = max(ans, dp[i]);
  }
  re_dp[n + 1] = arr[n + 1] = 0;
  for (int i = n; i >= 1; i--) {
    re_dp[i] = max(re_dp[i + 1] + arr[i], arr[i]);
    if (re_dp[i] < 0) re_dp[i] = 0;
    ans = max(ans, re_dp[i]);
  }
  new_dp[0] = new_re_dp[n + 1] = 0;
  for (int i = 1; i <= n; i++) {
    new_dp[i] = max(new_dp[i - 1], dp[i - 1]) + arr[i] * m;
    new_dp[i] = max(new_dp[i], max(0ll, dp[i]));
  }
  for (int i = n; i >= 1; i--) {
    new_re_dp[i] = max(new_re_dp[i + 1], re_dp[i + 1]) + arr[i] * m;
    new_re_dp[i] = max(new_re_dp[i], max(0ll, re_dp[i]));
  }
  for (int i = 0; i <= n; i++) {
    ans = max(ans, new_dp[i] + new_re_dp[i + 1]);
  }
  printf("%I64d\n", ans);
}
