#include <bits/stdc++.h>
using namespace std;
const int N = 3e5 + 5;
const int INF = 0x3f3f3f3f;
const long long INF_LL = 0x3f3f3f3f3f3f3f3f;
long long f[N][3][3];
long long a[N];
int main() {
  ios::sync_with_stdio(0);
  for (int i = 0; i < N; i++)
    for (int j = 0; j <= 2; j++)
      for (int k = 0; k <= 2; k++) f[i][j][k] = -INF_LL;
  f[0][0][0] = 0;
  int n, mul;
  cin >> n >> mul;
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 0; i <= n; i++) {
    for (int j = 0; j <= 2; j++)
      for (int k = 0; k <= 2; k++) {
        if (j > 0) f[i][j][k] = max(f[i][j][k], f[i][j - 1][k]);
        if (k > 0) f[i][j][k] = max(f[i][j][k], f[i][j][k - 1]);
        if (i > 0)
          f[i][j][k] =
              max(f[i][j][k], f[i - 1][j][k] + 1LL * (j == 1 ? a[i] : 0) *
                                                   (k == 1 ? mul : 1));
      }
  }
  cout << f[n][2][2] << endl;
  return 0;
}
