#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const int MOD = 1e9 + 7;
const int MAXN = 3e5 + 5;
const double PI = acos(-1);
long long a[MAXN][2];
long long dp[MAXN][2][2];
int main(void) {
  int n, x;
  scanf("%d%d", &n, &x);
  for (int i = 1; i <= n; i++) {
    scanf("%lld", &a[i][0]);
    a[i][1] = a[i][0] * x;
  }
  dp[0][0][1] = 0;
  dp[0][1][1] = 0;
  dp[0][0][0] = 0;
  dp[0][1][0] = 0;
  long long ans = 0;
  for (int i = 1; i <= n; i++) {
    dp[i][0][0] = max(1ll * a[i][0], dp[i - 1][0][0] + 1ll * a[i][0]);
    dp[i][1][1] = max(1ll * a[i][1], dp[i - 1][1][1] + 1ll * a[i][1]);
    dp[i][1][0] = max(a[i][0], dp[i - 1][1][1] + 1ll * a[i][0]);
    dp[i][1][0] = max(dp[i][1][0], dp[i - 1][1][0] + 1ll * a[i][0]);
    dp[i][1][0] = max(dp[i][1][0], dp[i - 1][0][1] + 1ll * a[i][0]);
    dp[i][0][1] = max(a[i][1], dp[i - 1][0][1] + 1ll * a[i][1]);
    dp[i][0][1] = max(dp[i][0][1], dp[i - 1][0][0] + a[i][1]);
    ans = max(ans, dp[i][0][1]);
    ans = max(ans, dp[i][0][0]);
    ans = max(ans, dp[i][1][1]);
    ans = max(ans, dp[i][1][0]);
  }
  printf("%lld\n", ans);
}
