import java.util.*;

import java.io.*;

public class B {
	static BufferedReader br;
	static PrintWriter pw;
	static int inf = (int) 1e9;
	static long mod = (long) 1e9 + 7;
	static int[] coin, k;
	static long[] cum;
	static int n, x;
	static long[] a;

	static long dp(int idx, int s, int sta) {
		if (idx == n || sta == 2)
			return 0;
		if (memo[sta][s][idx] != -1)
			return memo[sta][s][idx];
		long ans = 0;
		if (s == 0) {
			if (sta == 0) {
				ans = Math.max(dp(idx + 1, 0, 0), dp(idx + 1, 1, 1) + a[idx] * x);
				ans = Math.max(ans, dp(idx + 1, 0, 1) + a[idx]);
			} else if (sta == 1) {
				ans = Math.max(dp(idx + 1, 0, 2), dp(idx + 1, 0, 1) + a[idx]);
				ans = Math.max(ans, dp(idx + 1, 1, 1) + a[idx] * x);
			}
		} else if (s == 1) {
				ans = Math.max(dp(idx + 1, 0, 2), dp(idx + 1, 2, 1) + a[idx]);
				ans = Math.max(ans, dp(idx + 1, 1, 1) + a[idx] * x);
		} else {
			ans = Math.max(dp(idx + 1, 2, 2), dp(idx + 1, 2, 1) + a[idx]);
		}

		return memo[sta][s][idx] = ans;
	}

	public static void main(String[] args) throws NumberFormatException, IOException, InterruptedException {
		br = new BufferedReader(new InputStreamReader(System.in));
		Scanner sc = new Scanner(System.in);
		pw = new PrintWriter(System.out);
		n = sc.nextInt();
		x = sc.nextInt();
		a = new long[n];
		for (int i = 0; i < a.length; i++) {
			a[i] = sc.nextLong();
		}
		memo = new long[3][3][n];
		Arrays.fill(memo[0][0], -1);
		Arrays.fill(memo[1][0], -1);
		Arrays.fill(memo[2][0], -1);
		Arrays.fill(memo[0][1], -1);
		Arrays.fill(memo[1][1], -1);
		Arrays.fill(memo[2][1], -1);
		Arrays.fill(memo[0][2], -1);
		Arrays.fill(memo[1][2], -1);
		Arrays.fill(memo[2][2], -1);

		pw.println(dp(0, 0, 0));
		pw.flush();
		pw.close();
	}

	static long[][][] memo;

	static int findmax(int[] a) {
		int max = -1;
		int c = 0;
		for (int i = 0; i < n; i++) {
			c += a[i];
		}
		max = c;
		for (int i = 0; i < a.length; i++) {
			c -= a[i];
			c += a[(n + i) % (2 * n)];
			max = Math.max(max, c);
		}
		return max;
	}

	static double pow(double a, int e) // O(log e)
	{
		double res = 1;
		while (e > 0) {
			if ((e & 1) == 1)
				res *= a;
			a *= a;
			e >>= 1;
		}
		return res;
	}

	static boolean check(int x) {
		int c = 0;
		while (x > 0) {
			c += x % 10;
			x /= 10;
		}
		return c % 3 == 0;
	}

	static class SegmentTree { // 1-based DS, OOP

		int N; // the number of elements in the array as a power of 2 (i.e. after padding)
		int[] array, sTree, lazy;

		SegmentTree(int[] in) {
			array = in;
			N = in.length - 1;
			sTree = new int[N << 1]; // no. of nodes = 2*N - 1, we add one to cross out index zero
			lazy = new int[N << 1];
			build(1, 1, N);
		}

		void build(int node, int b, int e) // O(n)
		{
			if (b == e)
				sTree[node] = array[b];
			else {
				int mid = b + e >> 1;
				build(node << 1, b, mid);
				build(node << 1 | 1, mid + 1, e);
				int ql = sTree[node << 1];
				int qr = sTree[node << 1 | 1];
				sTree[node] = ql + qr;
			}
		}

		void update_point(int index, int val) // O(log n)
		{
			index += N - 1;
			sTree[index] += val;
			while (index > 1) {
				index >>= 1;
				sTree[index] = sTree[index << 1] + sTree[index << 1 | 1];
			}
		}

		void update_range(int i, int j, int val) // O(log n)
		{
			update_range(1, 1, N, i, j, val);
		}

		void update_range(int node, int b, int e, int i, int j, int val) {
			if (i > e || j < b)
				return;
			if (b >= i && e <= j) {
				sTree[node] += (e - b + 1) * val;
				lazy[node] += val;
			} else {
				int mid = b + e >> 1;
				propagate(node, b, mid, e);
				update_range(node << 1, b, mid, i, j, val);
				update_range(node << 1 | 1, mid + 1, e, i, j, val);
				int ql = sTree[node << 1];
				int qr = sTree[node << 1 | 1];
				sTree[node] = ql + qr;
			}

		}

		void propagate(int node, int b, int mid, int e) {
			lazy[node << 1] += lazy[node];
			lazy[node << 1 | 1] += lazy[node];
			sTree[node << 1] += (mid - b + 1) * lazy[node];
			sTree[node << 1 | 1] += (e - mid) * lazy[node];
			lazy[node] = 0;
		}

		int query(int i, int j) {
			return query(1, 1, N, i, j);
		}

		int query(int node, int b, int e, int i, int j) // O(log n)
		{
			if (i > e || j < b)
				return 0;
			if (b >= i && e <= j)
				return sTree[node];
			int mid = b + e >> 1;
			propagate(node, b, mid, e);
			int q1 = query(node << 1, b, mid, i, j);
			int q2 = query(node << 1 | 1, mid + 1, e, i, j);
			return q1 + q2;

		}

	}

	static long gcd(long a, long b) {
		if (a == 0)
			return b;
		return gcd(b % a, a);
	}

	// method to return LCM of two numbers
	static long lcm(long a, long b) {
		return (a * b) / gcd(a, b);
	}

	static double dis(int x, int y, int z, int w) {
		return Math.sqrt((x - z) * (x - z) + (y - w) * (y - w));
	}

	static int[] nxtarr() throws IOException {
		StringTokenizer st = new StringTokenizer(br.readLine());
		int[] a = new int[st.countTokens()];
		for (int i = 0; i < a.length; i++) {
			a[i] = Integer.parseInt(st.nextToken());
		}
		return a;
	}

	static long[] nxtarrLong() throws IOException {
		StringTokenizer st = new StringTokenizer(br.readLine());
		long[] a = new long[st.countTokens()];
		for (int i = 0; i < a.length; i++) {
			a[i] = Long.parseLong(st.nextToken());
		}
		return a;
	}

	static class pair implements Comparable<pair> {
		long x;
		long y;

		public pair(long d, long u) {
			x = d;
			y = u;
		}

		@Override
		public int compareTo(pair o) {
//			// TODO Auto-generated method stub
//			if (y == o.y)
//				return x - o.x;
			return 0;
		}

	}

	static class triple implements Comparable<triple> {
		int x;
		int y;
		int z;

		public triple(int a, int b, int c) {
			x = a;
			y = b;
			z = c;
		}

		@Override
		public int compareTo(triple o) {
			// TODO Auto-generated method stub
			return x - o.x;
		}
	}

	static class Scanner {
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream s) {
			br = new BufferedReader(new InputStreamReader(s));
		}

		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}

		public String nextLine() throws IOException {
			return br.readLine();
		}

		public boolean ready() throws IOException {
			return br.ready();
		}

	}
}


import java.io.*;
import java.util.*;

public class Main {
    public static void main(String... args) { new Main().work(); }

    void work() { WORK(); out.close(); }

    class InputReader {
    	BufferedReader br;
    	StringTokenizer st;

    	InputReader(InputStream stream) {
    		br = new BufferedReader(new InputStreamReader(stream));
    		st = null;
    	}

    	String next() {
			while(st==null || !st.hasMoreTokens()) {
				try { st = new StringTokenizer(br.readLine()); }
				catch(IOException e) { e.printStackTrace(); }
			}
    		return st.nextToken();
    	}

    	int nextInt() { return Integer.parseInt(next()); }
    	long nextLong() { return Long.parseLong(next()); }
    }

    InputReader in = new InputReader(System.in);
    PrintWriter out = new PrintWriter(System.out);

    final int N = (int)(3e5+10);
    final int INF = 0x3f3f3f3f;

    long[][] dp = new long[N][3];

    void WORK() {
    	int n = in.nextInt(), y = in.nextInt();
    	long ans = 0;
    	for(int i = 1; i <= n; i++) {
    		long x = in.nextLong();
    		dp[i][0] = Math.max(dp[i-1][0]+x, x);
    		dp[i][1] = Math.max(Math.max(dp[i-1][0], dp[i-1][1])+x*y, x*y);
    		dp[i][2] = Math.max(Math.max(dp[i-1][1], dp[i-1][2])+x, x);
    		for(int j = 0; j < 3; j++) ans = Math.max(ans, dp[i][j]);
    	}
    	out.println(ans);
    	out.flush();
    }
}


import java.util.*;
import java.io.*;
import java.math.*;
public class Solution{

    static long[][] dp;
    static long[] a;

    static long sum(int n,int i,long x){
        long max = 0;
        if(i==n+1) return 0;

        dp[i][0] = (long) Math.max(0,dp[i-1][0]) + a[i];
        dp[i][1] = (long) Math.max(dp[i-1][0],dp[i-1][1]) + a[i]*x;
        dp[i][2] = (long) Math.max(dp[i-1][2],dp[i-1][1]) + a[i];

        max = 0;
        max = (long) Math.max(Math.max(dp[i][0],max),Math.max(dp[i][1],dp[i][2]));

        max = (long) Math.max(sum(n,i+1,x),max);
        return max;

    }

    public static void main(String[] args)throws IOException{

        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        long x = sc.nextLong();
        a = new long[n+1];
        for(int i=1;i<=n;i++) a[i] = sc.nextLong();
        if(x>0){
            long val = 0;
            long max = 0;
            for(int i=1;i<=n;i++){
                if(val + a[i]>0) val += a[i];
                else val = 0;
                if(max<val) max = val;
            }
            max *= x;
            System.out.println(max);

        }else{

            dp = new long[n+1][3];
            for(int i=0;i<=n;i++){
                Arrays.fill(dp[i],(long)(-1*Math.pow(10,18)));
            }
            dp[0][0] = 0;

            long max = sum(n,1,x);

            System.out.println(max);

        }
    }
}


/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
//package codechefe;

import java.io.BufferedReader;
import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Codechefe {

    public static void main(String[] args) throws IOException {
      FastScanner fs=new FastScanner();
      int n=fs.nextInt();
      int x=fs.nextInt();
      long a[]=fs.readLongArray(n);
      long dp[][][]=new long[n+1][2][2];
      dp[0][0][0]=a[0];
      dp[0][1][1]=x*a[0];
      long ans=Math.max(0,Math.max(a[0], x*a[0]));
        //System.out.println(ans);
      for(int i=1;i<n;i++)
      {
          dp[i][1][0]=Math.max(a[i], a[i]+ dp[i-1][1][0]);

          dp[i][1][1]=Math.max(x*a[i], x*a[i]+Math.max(dp[i-1][1][1], dp[i-1][1][0]));
           dp[i][0][0]=Math.max(a[i], a[i]+Math.max(dp[i-1][1][1],dp[i-1][0][0]));

          ans=Math.max(ans,Math.max(dp[i][0][0], Math.max(dp[i][1][1], dp[i][1][0])));
      }
        System.out.println(ans);
    }
  static class FastScanner {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st=new StringTokenizer("");

		public String next() {
			while (!st.hasMoreTokens())
				try {
					st=new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();

		}

		public int nextInt() {
			return Integer.parseInt(next());
		}

		public int[] readArray(int n) {
			int[] a=new int[n];
			for (int i=0; i<n; i++) a[i]=nextInt();
			return a;
		}

		public long nextLong() {
			return Long.parseLong(next());
		}

		public long[] readLongArray(int n) {
			long[] a=new long[n];
			for (int i=0; i<n; i++) a[i]=nextLong();
			return a;
		}
	}

}


/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
//package codechefe;

import java.io.BufferedReader;
import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Codechefe {

    public static void main(String[] args) throws IOException {
      FastScanner fs=new FastScanner();
      int n=fs.nextInt();
      int x=fs.nextInt();
      long a[]=fs.readLongArray(n);
      long dp[][][]=new long[n+1][2][2];
      dp[0][0][0]=a[0];
      dp[0][1][1]=x*a[0];
      long ans=Math.max(0,Math.max(a[0], x*a[0]));
        //System.out.println(ans);
      for(int i=1;i<n;i++)
      {
          dp[i][1][0]=Math.max(a[i], a[i]+Math.max( dp[i-1][1][0],dp[i-1][1][1]));

          dp[i][1][1]=Math.max(x*a[i], x*a[i]+Math.max(dp[i-1][1][1], dp[i-1][0][0]));
           dp[i][0][0]=Math.max(a[i], a[i]+dp[i-1][0][0]);

          ans=Math.max(ans,Math.max(dp[i][0][0], Math.max(dp[i][1][1], dp[i][1][0])));
      }
        System.out.println(ans);
    }
  static class FastScanner {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st=new StringTokenizer("");

		public String next() {
			while (!st.hasMoreTokens())
				try {
					st=new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();

		}

		public int nextInt() {
			return Integer.parseInt(next());
		}

		public int[] readArray(int n) {
			int[] a=new int[n];
			for (int i=0; i<n; i++) a[i]=nextInt();
			return a;
		}

		public long nextLong() {
			return Long.parseLong(next());
		}

		public long[] readLongArray(int n) {
			long[] a=new long[n];
			for (int i=0; i<n; i++) a[i]=nextLong();
			return a;
		}
	}

}


// Don't place your source in a package
import java.util.*;
import java.lang.*;
import java.io.*;

// Please name your class Main
public class Main {
	public static void main (String[] args) throws java.lang.Exception {
	    Scanner scan=new Scanner(System.in);
	    int n=scan.nextInt();
	    long x=scan.nextInt();
	    long[] a=new long[n];
	    for(int i=0;i<n;i++) a[i]=scan.nextInt();
	    long[][] dp=new long[n+1][3];
	    //0=haven't encountered it
	    //1=in the middle of it
	    //2=passed it
	    for(int i=1;i<=n;i++) {
	        dp[i][0]=Math.max(dp[i][0],dp[i-1][0]+a[i-1]);
	        dp[i][1]=Math.max(dp[i][1],dp[i-1][1]+a[i-1]*x);
	        dp[i][1]=Math.max(dp[i][1],dp[i-1][0]+a[i-1]*x);
	        dp[i][2]=Math.max(dp[i][2],dp[i-1][2]+a[i-1]);
	        dp[i][2]=Math.max(dp[i][2],dp[i-1][1]+a[i-1]);
	    }
	    long res=Math.max(dp[n][0],dp[n][1]);
	    res=Math.max(res,dp[n][2]);
	    System.out.println(res);
	}
}


// Don't place your source in a package
import java.util.*;
import java.lang.*;
import java.io.*;

// Please name your class Main
public class Main {
	public static void main (String[] args) throws java.lang.Exception {
	    Scanner scan=new Scanner(System.in);
	    int n=scan.nextInt(), x=scan.nextInt();
	    int[] a=new int[n];
	    for(int i=0;i<n;i++) a[i]=scan.nextInt();
	    long[][] dp=new long[n][3];
	    dp[0][0]=Math.max(a[0],0);
	    //0=haven't encountered it
	    //1=in the middle of it
	    //2=passed it
	    for(int i=1;i<n;i++) {
	        dp[i][0]=Math.max(dp[i][0],dp[i-1][0]+a[i]);
	        dp[i][1]=Math.max(dp[i][1],dp[i-1][1]+a[i]*x);
	        dp[i][1]=Math.max(dp[i][1],dp[i-1][0]+a[i]*x);
	        dp[i][2]=Math.max(dp[i][2],dp[i-1][2]+a[i]);
	        dp[i][2]=Math.max(dp[i][2],dp[i-1][1]+a[i]);
	    }
	    long res=Math.max(dp[n-1][0],dp[n-1][1]);
	    res=Math.max(res,dp[n-1][2]);
	    res=Math.max(res,0);
	    System.out.println(res);
	}
}


// Don't place your source in a package
import java.util.*;
import java.lang.*;
import java.io.*;

// Please name your class Main
public class Main {
	public static void main (String[] args) throws java.lang.Exception {
	    Scanner scan=new Scanner(System.in);
	    int n=scan.nextInt(), x=scan.nextInt();
	    int[] a=new int[n];
	    for(int i=0;i<n;i++) a[i]=scan.nextInt();
	    long[][] dp=new long[n][3];
	    dp[0][0]=Math.max(dp[0][0],a[0]);
	    dp[0][1]=Math.max(dp[0][1],a[0]*x);
	    dp[0][2]=Math.max(dp[0][2],a[0]);
	    //0=haven't encountered it
	    //1=in the middle of it
	    //2=passed it
	    for(int i=1;i<n;i++) {
	        dp[i][0]=Math.max(dp[i][0],dp[i-1][0]+a[i]);
	        dp[i][1]=Math.max(dp[i][1],dp[i-1][1]+a[i]*x);
	        dp[i][1]=Math.max(dp[i][1],dp[i-1][0]+a[i]*x);
	        dp[i][2]=Math.max(dp[i][2],dp[i-1][2]+a[i]);
	        dp[i][2]=Math.max(dp[i][2],dp[i-1][1]+a[i]);
	    }
	    long res=Math.max(dp[n-1][0],dp[n-1][1]);
	    res=Math.max(res,dp[n-1][2]);
	    System.out.println(res);
	}
}


// Don't place your source in a package
import java.util.*;
import java.lang.*;
import java.io.*;

// Please name your class Main
public class Main {
	public static void main (String[] args) throws java.lang.Exception {
	    Scanner scan=new Scanner(System.in);
	    int n=scan.nextInt();
	    long x=scan.nextInt();
	    long[] a=new long[n];
	    for(int i=0;i<n;i++) a[i]=scan.nextInt();
	    long[][] dp=new long[n][3];
	    dp[0][0]=Math.max(dp[0][0],a[0]);
	    dp[0][1]=Math.max(dp[0][1],a[0]*x);
	    dp[0][2]=Math.max(dp[0][2],a[0]);
	    //0=haven't encountered it
	    //1=in the middle of it
	    //2=passed it
	    for(int i=1;i<n;i++) {
	        dp[i][0]=Math.max(dp[i][0],dp[i-1][0]+a[i]);
	        dp[i][1]=Math.max(dp[i][1],dp[i-1][1]+a[i]*x);
	        dp[i][1]=Math.max(dp[i][1],dp[i-1][0]+a[i]*x);
	        dp[i][2]=Math.max(dp[i][2],dp[i-1][2]+a[i]);
	        dp[i][2]=Math.max(dp[i][2],dp[i-1][1]+a[i]);
	    }
	    long res=Math.max(dp[n-1][0],dp[n-1][1]);
	    res=Math.max(res,dp[n-1][2]);
	    System.out.println(res);
	}
}


// Don't place your source in a package
import java.util.*;
import java.lang.*;
import java.io.*;

// Please name your class Main
public class Main {
	public static void main (String[] args) throws java.lang.Exception {
	    Scanner scan=new Scanner(System.in);
	    int n=scan.nextInt();
	    long x=scan.nextInt();
	    long[] a=new long[n];
	    for(int i=0;i<n;i++) a[i]=scan.nextInt();
	    long[][] dp=new long[n+1][3];
	    //0=haven't encountered it
	    //1=in the middle of it
	    //2=passed it
	    long res=0L;
	    for(int i=1;i<=n;i++) {
	        dp[i][0]=Math.max(dp[i][0],dp[i-1][0]+a[i-1]);
	        dp[i][1]=Math.max(dp[i][1],dp[i-1][1]+a[i-1]*x);
	        dp[i][1]=Math.max(dp[i][1],dp[i-1][0]+a[i-1]*x);
	        dp[i][2]=Math.max(dp[i][2],dp[i-1][2]+a[i-1]);
	        dp[i][2]=Math.max(dp[i][2],dp[i-1][1]+a[i-1]);
	        res=Math.max(dp[i][0],dp[i][1]);
	        res=Math.max(res,dp[i][2]);
	    }
	    System.out.println(res);
	}
}


// Don't place your source in a package
import java.util.*;
import java.lang.*;
import java.io.*;

// Please name your class Main
public class Main {
	public static void main (String[] args) throws java.lang.Exception {
	    Scanner scan=new Scanner(System.in);
	    int n=scan.nextInt();
	    long x=scan.nextInt();
	    long[] a=new long[n];
	    for(int i=0;i<n;i++) a[i]=scan.nextInt();
	    long[][] dp=new long[n+1][3];
	    //0=haven't encountered it
	    //1=in the middle of it
	    //2=passed it
	    long res=0L;
	    for(int i=1;i<=n;i++) {
	        dp[i][0]=Math.max(dp[i][0],dp[i-1][0]+a[i-1]);
	        dp[i][1]=Math.max(dp[i][1],dp[i-1][1]+a[i-1]*x);
	        dp[i][1]=Math.max(dp[i][1],dp[i-1][0]+a[i-1]*x);
	        dp[i][2]=Math.max(dp[i][2],dp[i-1][2]+a[i-1]);
	        dp[i][2]=Math.max(dp[i][2],dp[i-1][1]+a[i-1]);
	        res=Math.max(res,dp[i][0]);
            res=Math.max(res,dp[i][1]);
	        res=Math.max(res,dp[i][2]);
	    }
	    System.out.println(res);
	}
}


// Don't place your source in a package
import java.util.*;
import java.lang.*;
import java.io.*;

// Please name your class Main
public class Main {
	public static void main (String[] args) throws java.lang.Exception {
	    Scanner scan=new Scanner(System.in);
	    int n=scan.nextInt(), x=scan.nextInt();
	    int[] a=new int[n];
	    for(int i=0;i<n;i++) a[i]=scan.nextInt();
	    long[][] dp=new long[n][3];
	    dp[0][0]=a[0];
	    //0=haven't encountered it
	    //1=in the middle of it
	    //2=passed it
	    for(int i=1;i<n;i++) {
	        dp[i][0]=Math.max(dp[i][0],dp[i-1][0]+a[i]);
	        dp[i][1]=Math.max(dp[i][1],dp[i-1][1]+a[i]*x);
	        dp[i][1]=Math.max(dp[i][1],dp[i-1][0]+a[i]*x);
	        dp[i][2]=Math.max(dp[i][2],dp[i-1][2]+a[i]);
	        dp[i][2]=Math.max(dp[i][2],dp[i-1][1]+a[i]);
	    }
	    long res=Math.max(dp[n-1][0],dp[n-1][1]);
	    res=Math.max(res,dp[n-1][2]);
	    res=Math.max(res,0);
	    System.out.println(res);
	}
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author sumit
 */
public class Main {
      public static void main(String[] args) {
            InputStream inputStream = System.in;
            OutputStream outputStream = System.out;
            InputReader in = new InputReader(inputStream);
            OutputWriter out = new OutputWriter(outputStream);
            DBeautifulArray solver = new DBeautifulArray();
            solver.solve(1, in, out);
            out.close();
      }

      static class DBeautifulArray {
            public void solve(int testNumber, InputReader in, OutputWriter out) {
                  int n = in.nextInt();
                  int x = in.nextInt();
                  int arr[] = in.nextIntArray(n);
                  if (x > 0) {
                        int maxh = 0;
                        int max = 0;

                        for (int i = 0; i < n; i++) {
                              maxh = maxh + arr[i];
                              if (max < maxh) {
                                    max = maxh;
                              }
                              if (maxh < 0)
                                    maxh = 0;
                        }
                        out.printLine(max * x);
                  } else {
                        int ind1 = -1;
                        int ind2 = -1;
                        int maxh = 0;
                        int max = 0;

                        for (int i = 0; i < n; i++) {
                              maxh = maxh + arr[i];
                              if (max > maxh) {
                                    max = maxh;
                                    ind2 = i;
                              }
                              if (maxh > 0) {
                                    maxh = 0;
                                    ind1 = i + 1;
                              }
                        }
                        if (ind1 != -1 && ind1 <= ind2) {
                              for (int i = ind1; i <= ind2 && i < n; i++) {
                                    arr[i] = arr[i] * x;
                              }
                        }

                        maxh = 0;
                        max = 0;

                        for (int i = 0; i < n; i++) {
                              maxh = maxh + arr[i];
                              if (max < maxh) {
                                    max = maxh;
                              }
                              if (maxh < 0)
                                    maxh = 0;
                        }
                        out.printLine(max);

                  }

                  int minh = 0;
                  int min = 0;

                  for (int i = 0; i < n; i++) {
                        minh = minh + arr[i];
                        if (min > minh) {
                              min = minh;
                        }
                        if (minh > 0)
                              minh = 0;
                  }

            }

      }

      static class InputReader {
            private InputStream stream;
            private byte[] buf = new byte[1024];
            private int curChar;
            private int numChars;

            public InputReader(InputStream stream) {
                  this.stream = stream;
            }

            public int read() {
                  if (numChars == -1)
                        throw new InputMismatchException();

                  if (curChar >= numChars) {
                        curChar = 0;
                        try {
                              numChars = stream.read(buf);
                        } catch (IOException e) {
                              throw new InputMismatchException();
                        }
                        if (numChars <= 0)
                              return -1;
                  }

                  return buf[curChar++];
            }

            public int nextInt() {
                  int c = read();

                  while (isSpaceChar(c))
                        c = read();

                  int sgn = 1;

                  if (c == '-') {
                        sgn = -1;
                        c = read();
                  }

                  int res = 0;

                  do {
                        if (c < '0' || c > '9')
                              throw new InputMismatchException();

                        res *= 10;
                        res += c & 15;

                        c = read();
                  } while (!isSpaceChar(c));

                  return res * sgn;
            }

            public int[] nextIntArray(int arraySize) {
                  int array[] = new int[arraySize];

                  for (int i = 0; i < arraySize; i++)
                        array[i] = nextInt();

                  return array;
            }

            public boolean isSpaceChar(int c) {
                  return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
            }

      }

      static class OutputWriter {
            private final PrintWriter writer;

            public OutputWriter(OutputStream outputStream) {
                  writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
            }

            public OutputWriter(Writer writer) {
                  this.writer = new PrintWriter(writer);
            }

            public void close() {
                  writer.close();
            }

            public void printLine(int i) {
                  writer.println(i);
            }

      }
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author sumit
 */
public class Main {
      public static void main(String[] args) {
            InputStream inputStream = System.in;
            OutputStream outputStream = System.out;
            InputReader in = new InputReader(inputStream);
            OutputWriter out = new OutputWriter(outputStream);
            DBeautifulArray solver = new DBeautifulArray();
            solver.solve(1, in, out);
            out.close();
      }

      static class DBeautifulArray {
            public void solve(int testNumber, InputReader in, OutputWriter out) {
                  int n = in.nextInt();
                  int x = in.nextInt();
                  int arr[] = in.nextIntArray(n);
                  int left[] = new int[n];
                  int right[] = new int[n];
                  int sum[] = new int[n];
                  sum[0] = arr[0];
                  if (arr[0] > 0)
                        left[0] = arr[0];
                  for (int i = 1; i < n; i++) {
                        sum[i] = arr[i] + sum[i - 1];
                        left[i] = left[i - 1] + arr[i];
                        if (left[i] < 0)
                              left[i] = 0;
                  }
                  if (arr[n - 1] > 0)
                        right[n - 1] = arr[n - 1];
                  for (int i = n - 2; i >= 0; i--) {
                        right[i] = right[i + 1] + arr[i];
                        if (right[i] < 0)
                              right[i] = 0;
                  }

                  int max = arr[0];
                  if (n > 1)
                        max += right[1];
                  int curr = left[0] - (x * sum[0]);
                  for (int i = 1; i < n; i++) {
                        curr = Math.max(curr, left[i - 1] - (x * sum[i - 1]));
                        if (i < n - 1)
                              max = Math.max(curr + right[i + 1] + (x * sum[i]), max);
                        else
                              max = Math.max(curr + (x * sum[i]), max);
                  }
                  if (max < 0)
                        max = 0;
                  out.printLine(max);

            }

      }

      static class OutputWriter {
            private final PrintWriter writer;

            public OutputWriter(OutputStream outputStream) {
                  writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
            }

            public OutputWriter(Writer writer) {
                  this.writer = new PrintWriter(writer);
            }

            public void close() {
                  writer.close();
            }

            public void printLine(int i) {
                  writer.println(i);
            }

      }

      static class InputReader {
            private InputStream stream;
            private byte[] buf = new byte[1024];
            private int curChar;
            private int numChars;

            public InputReader(InputStream stream) {
                  this.stream = stream;
            }

            public int read() {
                  if (numChars == -1)
                        throw new InputMismatchException();

                  if (curChar >= numChars) {
                        curChar = 0;
                        try {
                              numChars = stream.read(buf);
                        } catch (IOException e) {
                              throw new InputMismatchException();
                        }
                        if (numChars <= 0)
                              return -1;
                  }

                  return buf[curChar++];
            }

            public int nextInt() {
                  int c = read();

                  while (isSpaceChar(c))
                        c = read();

                  int sgn = 1;

                  if (c == '-') {
                        sgn = -1;
                        c = read();
                  }

                  int res = 0;

                  do {
                        if (c < '0' || c > '9')
                              throw new InputMismatchException();

                        res *= 10;
                        res += c & 15;

                        c = read();
                  } while (!isSpaceChar(c));

                  return res * sgn;
            }

            public int[] nextIntArray(int arraySize) {
                  int array[] = new int[arraySize];

                  for (int i = 0; i < arraySize; i++)
                        array[i] = nextInt();

                  return array;
            }

            public boolean isSpaceChar(int c) {
                  return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
            }

      }
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author sumit
 */
public class Main {
      public static void main(String[] args) {
            InputStream inputStream = System.in;
            OutputStream outputStream = System.out;
            InputReader in = new InputReader(inputStream);
            OutputWriter out = new OutputWriter(outputStream);
            DBeautifulArray solver = new DBeautifulArray();
            solver.solve(1, in, out);
            out.close();
      }

      static class DBeautifulArray {
            public void solve(int testNumber, InputReader in, OutputWriter out) {
                  int n = in.nextInt();
                  int x = in.nextInt();
                  long arr[] = in.nextLongArray(n);
                  long left[] = new long[n];
                  long right[] = new long[n];
                  long sum[] = new long[n];
                  sum[0] = arr[0];
                  if (arr[0] > 0)
                        left[0] = arr[0];
                  for (int i = 1; i < n; i++) {
                        sum[i] = arr[i] + sum[i - 1];
                        left[i] = left[i - 1] + arr[i];
                        if (left[i] < 0)
                              left[i] = 0;
                  }
                  if (arr[n - 1] > 0)
                        right[n - 1] = arr[n - 1];
                  for (int i = n - 2; i >= 0; i--) {
                        right[i] = right[i + 1] + arr[i];
                        if (right[i] < 0)
                              right[i] = 0;
                  }

                  long max = arr[0];
                  if (n > 1)
                        max += right[1];
                  long curr = left[0] - (x * sum[0]);
                  for (int i = 1; i < n; i++) {
                        curr = Math.max(curr, left[i - 1] - (x * sum[i - 1]));
                        if (i < n - 1)
                              max = Math.max(curr + right[i + 1] + (x * sum[i]), max);
                        else
                              max = Math.max(curr + (x * sum[i]), max);
                  }
                  if (max < 0)
                        max = 0;
                  out.printLine(max);

            }

      }

      static class OutputWriter {
            private final PrintWriter writer;

            public OutputWriter(OutputStream outputStream) {
                  writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
            }

            public OutputWriter(Writer writer) {
                  this.writer = new PrintWriter(writer);
            }

            public void close() {
                  writer.close();
            }

            public void printLine(long i) {
                  writer.println(i);
            }

      }

      static class InputReader {
            private InputStream stream;
            private byte[] buf = new byte[1024];
            private int curChar;
            private int numChars;

            public InputReader(InputStream stream) {
                  this.stream = stream;
            }

            public int read() {
                  if (numChars == -1)
                        throw new InputMismatchException();

                  if (curChar >= numChars) {
                        curChar = 0;
                        try {
                              numChars = stream.read(buf);
                        } catch (IOException e) {
                              throw new InputMismatchException();
                        }
                        if (numChars <= 0)
                              return -1;
                  }

                  return buf[curChar++];
            }

            public int nextInt() {
                  int c = read();

                  while (isSpaceChar(c))
                        c = read();

                  int sgn = 1;

                  if (c == '-') {
                        sgn = -1;
                        c = read();
                  }

                  int res = 0;

                  do {
                        if (c < '0' || c > '9')
                              throw new InputMismatchException();

                        res *= 10;
                        res += c & 15;

                        c = read();
                  } while (!isSpaceChar(c));

                  return res * sgn;
            }

            public long nextLong() {
                  int c = read();

                  while (isSpaceChar(c))
                        c = read();

                  int sign = 1;

                  if (c == '-') {
                        sign = -1;

                        c = read();
                  }

                  long result = 0;

                  do {
                        if (c < '0' || c > '9')
                              throw new InputMismatchException();

                        result *= 10;
                        result += c & 15;

                        c = read();
                  } while (!isSpaceChar(c));

                  return result * sign;
            }

            public long[] nextLongArray(int arraySize) {
                  long array[] = new long[arraySize];

                  for (int i = 0; i < arraySize; i++)
                        array[i] = nextLong();

                  return array;
            }

            public boolean isSpaceChar(int c) {
                  return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
            }

      }
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author sumit
 */
public class Main {
      public static void main(String[] args) {
            InputStream inputStream = System.in;
            OutputStream outputStream = System.out;
            InputReader in = new InputReader(inputStream);
            OutputWriter out = new OutputWriter(outputStream);
            DBeautifulArray solver = new DBeautifulArray();
            solver.solve(1, in, out);
            out.close();
      }

      static class DBeautifulArray {
            public void solve(int testNumber, InputReader in, OutputWriter out) {
                  int n = in.nextInt();
                  long x = in.nextInt();
                  long arr[] = in.nextLongArray(n);
                  long left[] = new long[n];
                  long right[] = new long[n];
                  long sum[] = new long[n];
                  sum[0] = arr[0];
                  if (arr[0] > 0)
                        left[0] = arr[0];
                  for (int i = 1; i < n; i++) {
                        sum[i] = arr[i] + sum[i - 1];
                        left[i] = left[i - 1] + arr[i];
                        if (left[i] < 0)
                              left[i] = 0;
                  }
                  if (arr[n - 1] > 0)
                        right[n - 1] = arr[n - 1];
                  for (int i = n - 2; i >= 0; i--) {
                        right[i] = right[i + 1] + arr[i];
                        if (right[i] < 0)
                              right[i] = 0;
                  }

                  long max = arr[0];
                  if (n > 1)
                        max += right[1];
                  long curr = left[0] - (x * sum[0]);
                  for (int i = 1; i < n; i++) {
                        curr = Math.max(curr, left[i - 1] - (x * sum[i - 1]));
                        if (i < n - 1)
                              max = Math.max(curr + right[i + 1] + (x * sum[i]), max);
                        else
                              max = Math.max(curr + (x * sum[i]), max);
                  }
                  if (max < 0)
                        max = 0;
                  out.printLine(max);

            }

      }

      static class OutputWriter {
            private final PrintWriter writer;

            public OutputWriter(OutputStream outputStream) {
                  writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
            }

            public OutputWriter(Writer writer) {
                  this.writer = new PrintWriter(writer);
            }

            public void close() {
                  writer.close();
            }

            public void printLine(long i) {
                  writer.println(i);
            }

      }

      static class InputReader {
            private InputStream stream;
            private byte[] buf = new byte[1024];
            private int curChar;
            private int numChars;

            public InputReader(InputStream stream) {
                  this.stream = stream;
            }

            public int read() {
                  if (numChars == -1)
                        throw new InputMismatchException();

                  if (curChar >= numChars) {
                        curChar = 0;
                        try {
                              numChars = stream.read(buf);
                        } catch (IOException e) {
                              throw new InputMismatchException();
                        }
                        if (numChars <= 0)
                              return -1;
                  }

                  return buf[curChar++];
            }

            public int nextInt() {
                  int c = read();

                  while (isSpaceChar(c))
                        c = read();

                  int sgn = 1;

                  if (c == '-') {
                        sgn = -1;
                        c = read();
                  }

                  int res = 0;

                  do {
                        if (c < '0' || c > '9')
                              throw new InputMismatchException();

                        res *= 10;
                        res += c & 15;

                        c = read();
                  } while (!isSpaceChar(c));

                  return res * sgn;
            }

            public long nextLong() {
                  int c = read();

                  while (isSpaceChar(c))
                        c = read();

                  int sign = 1;

                  if (c == '-') {
                        sign = -1;

                        c = read();
                  }

                  long result = 0;

                  do {
                        if (c < '0' || c > '9')
                              throw new InputMismatchException();

                        result *= 10;
                        result += c & 15;

                        c = read();
                  } while (!isSpaceChar(c));

                  return result * sign;
            }

            public long[] nextLongArray(int arraySize) {
                  long array[] = new long[arraySize];

                  for (int i = 0; i < arraySize; i++)
                        array[i] = nextLong();

                  return array;
            }

            public boolean isSpaceChar(int c) {
                  return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
            }

      }
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author sumit
 */
public class Main {
      public static void main(String[] args) {
            InputStream inputStream = System.in;
            OutputStream outputStream = System.out;
            InputReader in = new InputReader(inputStream);
            OutputWriter out = new OutputWriter(outputStream);
            DBeautifulArray solver = new DBeautifulArray();
            solver.solve(1, in, out);
            out.close();
      }

      static class DBeautifulArray {
            public void solve(int testNumber, InputReader in, OutputWriter out) {
                  int n = in.nextInt();
                  long x = in.nextInt();
                  long arr[] = in.nextLongArray(n);
                  long left[] = new long[n];
                  long right[] = new long[n];
                  long sum[] = new long[n];
                  sum[0] = arr[0];
                  if (arr[0] > 0)
                        left[0] = arr[0];
                  for (int i = 1; i < n; i++) {
                        sum[i] = arr[i] + sum[i - 1];
                        left[i] = left[i - 1] + arr[i];
                        if (left[i] < 0)
                              left[i] = 0;
                  }
                  if (arr[n - 1] > 0)
                        right[n - 1] = arr[n - 1];
                  for (int i = n - 2; i >= 0; i--) {
                        right[i] = right[i + 1] + arr[i];
                        if (right[i] < 0)
                              right[i] = 0;
                  }

                  long max = arr[0];
                  if (n > 1)
                        max += right[1];
                  long curr = 0;
                  for (int i = 1; i < n; i++) {
                        curr = Math.max(curr, left[i - 1] - (x * sum[i - 1]));
                        if (i < n - 1)
                              max = Math.max(curr + right[i + 1] + (x * sum[i]), max);
                        else
                              max = Math.max(curr + (x * sum[i]), max);
                  }
                  if (max < 0)
                        max = 0;
                  out.printLine(max);

            }

      }

      static class OutputWriter {
            private final PrintWriter writer;

            public OutputWriter(OutputStream outputStream) {
                  writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
            }

            public OutputWriter(Writer writer) {
                  this.writer = new PrintWriter(writer);
            }

            public void close() {
                  writer.close();
            }

            public void printLine(long i) {
                  writer.println(i);
            }

      }

      static class InputReader {
            private InputStream stream;
            private byte[] buf = new byte[1024];
            private int curChar;
            private int numChars;

            public InputReader(InputStream stream) {
                  this.stream = stream;
            }

            public int read() {
                  if (numChars == -1)
                        throw new InputMismatchException();

                  if (curChar >= numChars) {
                        curChar = 0;
                        try {
                              numChars = stream.read(buf);
                        } catch (IOException e) {
                              throw new InputMismatchException();
                        }
                        if (numChars <= 0)
                              return -1;
                  }

                  return buf[curChar++];
            }

            public int nextInt() {
                  int c = read();

                  while (isSpaceChar(c))
                        c = read();

                  int sgn = 1;

                  if (c == '-') {
                        sgn = -1;
                        c = read();
                  }

                  int res = 0;

                  do {
                        if (c < '0' || c > '9')
                              throw new InputMismatchException();

                        res *= 10;
                        res += c & 15;

                        c = read();
                  } while (!isSpaceChar(c));

                  return res * sgn;
            }

            public long nextLong() {
                  int c = read();

                  while (isSpaceChar(c))
                        c = read();

                  int sign = 1;

                  if (c == '-') {
                        sign = -1;

                        c = read();
                  }

                  long result = 0;

                  do {
                        if (c < '0' || c > '9')
                              throw new InputMismatchException();

                        result *= 10;
                        result += c & 15;

                        c = read();
                  } while (!isSpaceChar(c));

                  return result * sign;
            }

            public long[] nextLongArray(int arraySize) {
                  long array[] = new long[arraySize];

                  for (int i = 0; i < arraySize; i++)
                        array[i] = nextLong();

                  return array;
            }

            public boolean isSpaceChar(int c) {
                  return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
            }

      }
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author sumit
 */
public class Main {
      public static void main(String[] args) {
            InputStream inputStream = System.in;
            OutputStream outputStream = System.out;
            InputReader in = new InputReader(inputStream);
            OutputWriter out = new OutputWriter(outputStream);
            DBeautifulArray solver = new DBeautifulArray();
            solver.solve(1, in, out);
            out.close();
      }

      static class DBeautifulArray {
            public void solve(int testNumber, InputReader in, OutputWriter out) {
                  int n = in.nextInt();
                  long x = in.nextInt();
                  long arr[] = in.nextLongArray(n);
                  long left[] = new long[n];
                  long right[] = new long[n];
                  long sum[] = new long[n];
                  sum[0] = arr[0];
                  if (arr[0] > 0)
                        left[0] = arr[0];
                  for (int i = 1; i < n; i++) {
                        sum[i] = arr[i] + sum[i - 1];
                        left[i] = left[i - 1] + arr[i];
                        if (left[i] < 0)
                              left[i] = 0;
                  }
                  if (arr[n - 1] > 0)
                        right[n - 1] = arr[n - 1];
                  for (int i = n - 2; i >= 0; i--) {
                        right[i] = right[i + 1] + arr[i];
                        if (right[i] < 0)
                              right[i] = 0;
                  }

                  long max = Math.max(arr[0], x * arr[0]);
                  if (n > 1)
                        max += right[1];
                  long curr = 0;
                  for (int i = 1; i < n; i++) {
                        curr = Math.max(curr, left[i - 1] - (x * sum[i - 1]));
                        if (i < n - 1)
                              max = Math.max(curr + right[i + 1] + (x * sum[i]), max);
                        else
                              max = Math.max(curr + (x * sum[i]), max);
                  }
                  if (max < 0)
                        max = 0;
                  out.printLine(max);

            }

      }

      static class OutputWriter {
            private final PrintWriter writer;

            public OutputWriter(OutputStream outputStream) {
                  writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
            }

            public OutputWriter(Writer writer) {
                  this.writer = new PrintWriter(writer);
            }

            public void close() {
                  writer.close();
            }

            public void printLine(long i) {
                  writer.println(i);
            }

      }

      static class InputReader {
            private InputStream stream;
            private byte[] buf = new byte[1024];
            private int curChar;
            private int numChars;

            public InputReader(InputStream stream) {
                  this.stream = stream;
            }

            public int read() {
                  if (numChars == -1)
                        throw new InputMismatchException();

                  if (curChar >= numChars) {
                        curChar = 0;
                        try {
                              numChars = stream.read(buf);
                        } catch (IOException e) {
                              throw new InputMismatchException();
                        }
                        if (numChars <= 0)
                              return -1;
                  }

                  return buf[curChar++];
            }

            public int nextInt() {
                  int c = read();

                  while (isSpaceChar(c))
                        c = read();

                  int sgn = 1;

                  if (c == '-') {
                        sgn = -1;
                        c = read();
                  }

                  int res = 0;

                  do {
                        if (c < '0' || c > '9')
                              throw new InputMismatchException();

                        res *= 10;
                        res += c & 15;

                        c = read();
                  } while (!isSpaceChar(c));

                  return res * sgn;
            }

            public long nextLong() {
                  int c = read();

                  while (isSpaceChar(c))
                        c = read();

                  int sign = 1;

                  if (c == '-') {
                        sign = -1;

                        c = read();
                  }

                  long result = 0;

                  do {
                        if (c < '0' || c > '9')
                              throw new InputMismatchException();

                        result *= 10;
                        result += c & 15;

                        c = read();
                  } while (!isSpaceChar(c));

                  return result * sign;
            }

            public long[] nextLongArray(int arraySize) {
                  long array[] = new long[arraySize];

                  for (int i = 0; i < arraySize; i++)
                        array[i] = nextLong();

                  return array;
            }

            public boolean isSpaceChar(int c) {
                  return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
            }

      }
}


import java.io.*;
import java.util.*;

public class d {
    static class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        public FastScanner(Reader in) {
            br = new BufferedReader(in);
        }

        public FastScanner() {
            this(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }

        int[] nextIntArray(int n) {
            int[] a = new int[n];
            for (int idx = 0; idx < n; idx++) {
                a[idx] = nextInt();
            }
            return a;
        }
    }
    public static void main(String[] args) {

        FastScanner sc = new FastScanner();
        String s = sc.nextLine();
        String[] c = s.split(" ");
        int n = Integer.parseInt(c[0]);
        int x = Integer.parseInt(c[1]);
        String s2 = sc.nextLine();
        String[] cc = s2.split(" ");
        long[] a = new long[n];
        for(int i=0;i<n;i++)
        {
            a[i] = Long.parseLong(cc[i]);
        }
        long[][] dp = new long[n][3];
        dp[0][0] = a[0];
        dp[0][1] = a[0]*x;
        dp[0][2] = a[0];
        long max=0;

        for(int i=1;i<n;i++)
        {
            dp[i][0] = Math.max(dp[i-1][0]+a[i],a[i]);
            dp[i][1] = Math.max(Math.max(dp[i-1][0]+a[i]*x, dp[i-1][1]+a[i]*x),a[i]*x);
            dp[i][2] = Math.max(Math.max(Math.max(dp[i-1][0]+a[i],dp[i-1][1]+a[i]),dp[i-1][2]+a[i]),a[i]);
            max=Math.max(Math.max(Math.max(dp[i][0],dp[i][1]),dp[i][2]),max);
        }

        System.out.println(max);
    }
}


import java.io.*;
import java.util.*;

public class d {
    static class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        public FastScanner(Reader in) {
            br = new BufferedReader(in);
        }

        public FastScanner() {
            this(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }

        int[] nextIntArray(int n) {
            int[] a = new int[n];
            for (int idx = 0; idx < n; idx++) {
                a[idx] = nextInt();
            }
            return a;
        }
    }
    public static void main(String[] args) {

        FastScanner sc = new FastScanner();
        String s = sc.nextLine();
        String[] c = s.split(" ");
        int n = Integer.parseInt(c[0]);
        int x = Integer.parseInt(c[1]);
        String s2 = sc.nextLine();
        String[] cc = s2.split(" ");
        long[] a = new long[n];
        boolean bo = false;
        if(x>0)
        {
            bo=true;
        }
        long m = 0;
        int x1=0,y1=0,x2=0;
        if(!bo){
            long rent = 0;
            for(int i=0;i<n;i++)
            {
                a[i] = Long.parseLong(cc[i]);
                if(n==1)
                {
                    if(a[i]>0)
                    {
                        System.out.println(a[i]);
                        return;
                    }else
                    {
                        System.out.println((a[i]*x));
                        return;
                    }
                }
                if(rent>0)
                {
                    rent= a[i];
                    //System.out.println(a[i]);
                    x2=i;
                }
                else rent+=a[i];
                if(rent<m)
                {
                    x1=x2;
                    m=rent;
                    y1=i;
                    //System.out.println(x1+" "+m+" "+y1);
                }
            }
            //System.out.println(rent);
        }else
        {
            long rent = 0;
            for(int i=0;i<n;i++)
            {
                a[i] = Long.parseLong(cc[i]);
                if(n==1)
                {
                    if(a[i]>0)
                    {
                        System.out.println((a[i]*x));
                        return;
                    }else
                    {
                        System.out.println(a[i]);
                        return;
                    }
                }
                if(rent<0)
                {
                    rent= a[i];
                    x2=i;
                }
                else rent+=a[i];
                if(rent>m)
                {
                    x1=x2;
                    m=rent;
                    y1=i;
                }
            }
        }
        if(bo&&m<=0)
        {
            System.out.println(0);
            return;
        }
        if(!bo&&m>=0)
        {
            long sum=0;
            for(int i=0;i<n;i++)
            {
                sum+=a[i];
            }
            System.out.println(sum);
            return;
        }
        for(int i=x1;i<=y1;i++)
        {
            a[i] = a[i]*x;
            //System.out.println(a[i]);
        }
        long re = 0,max=0;
        for(int i=0;i<n;i++)
        {
            if(re<0)
            {
                re=a[i];
            }
            else re+=a[i];
            if(re>max)
            {
                max=re;
            }
        }
        System.out.println(max);
    }
}


import java.io.*;
import java.util.*;

public class d {
    static class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        public FastScanner(Reader in) {
            br = new BufferedReader(in);
        }

        public FastScanner() {
            this(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }

        int[] nextIntArray(int n) {
            int[] a = new int[n];
            for (int idx = 0; idx < n; idx++) {
                a[idx] = nextInt();
            }
            return a;
        }
    }
    public static void main(String[] args) {

        FastScanner sc = new FastScanner();
        String s = sc.nextLine();
        String[] c = s.split(" ");
        int n = Integer.parseInt(c[0]);
        int x = Integer.parseInt(c[1]);
        String s2 = sc.nextLine();
        String[] cc = s2.split(" ");
        int[] a = new int[n];
        boolean bo = false;
        if(x>0)
        {
            bo=true;
        }
        long m = 0;
        int x1=0,y1=0,x2=0;
        if(!bo){
            long rent = 0;
            for(int i=0;i<n;i++)
            {
                a[i] = Integer.parseInt(cc[i]);
                if(n==1)
                {
                    if(a[i]>0)
                    {
                        System.out.println(a[i]);
                        return;
                    }else
                    {
                        System.out.println((a[i]*x));
                        return;
                    }
                }
                if(rent>0)
                {
                    rent= a[i];
                    //System.out.println(a[i]);
                    x2=i;
                }
                else rent+=a[i];
                if(rent<m)
                {
                    x1=x2;
                    m=rent;
                    y1=i;
                    //System.out.println(x1+" "+m+" "+y1);
                }
            }
            //System.out.println(rent);
        }else
        {
            long rent = 0;
            for(int i=0;i<n;i++)
            {
                a[i] = Integer.parseInt(cc[i]);
                if(n==1)
                {
                    if(a[i]>0)
                    {
                        System.out.println((a[i]*x));
                        return;
                    }else
                    {
                        System.out.println(a[i]);
                        return;
                    }
                }
                if(rent<0)
                {
                    rent= a[i];
                    x2=i;
                }
                else rent+=a[i];
                if(rent>m)
                {
                    x1=x2;
                    m=rent;
                    y1=i;
                }
            }
        }
        if(bo&&m<=0)
        {
            System.out.println(0);
            return;
        }
        if(!bo&&m>=0)
        {
            long sum=0;
            for(int i=0;i<n;i++)
            {
                sum+=a[i];
            }
            System.out.println(sum);
            return;
        }
        for(int i=x1;i<=y1;i++)
        {
            a[i] = a[i]*x;
        }
        long re = 0,max=0;
        for(int i=0;i<n;i++)
        {
            if(re<0)
            {
                re= a[i];
            }
            else re+=a[i];
            if(re>max)
            {
                max=re;
            }
        }
        System.out.println(re);
    }
}


import java.io.*;
import java.util.*;

public class d {
    static class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        public FastScanner(Reader in) {
            br = new BufferedReader(in);
        }

        public FastScanner() {
            this(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }

        int[] nextIntArray(int n) {
            int[] a = new int[n];
            for (int idx = 0; idx < n; idx++) {
                a[idx] = nextInt();
            }
            return a;
        }
    }
    public static void main(String[] args) {

        FastScanner sc = new FastScanner();
        String s = sc.nextLine();
        String[] c = s.split(" ");
        int n = Integer.parseInt(c[0]);
        int x = Integer.parseInt(c[1]);
        String s2 = sc.nextLine();
        String[] cc = s2.split(" ");
        long[] a = new long[n];
        for(int i=0;i<n;i++)
        {
            a[i] = Long.parseLong(cc[i]);
        }
        long[][] dp = new long[n][3];

        if(a[0]>0) dp[0][0] = a[0];
        dp[0][1] = a[0]*x;
        dp[0][2] = a[0];
        long max=Math.max(Math.max(dp[0][0],dp[0][1]),dp[0][2]);

        for(int i=1;i<n;i++)
        {
            dp[i][0] = Math.max(dp[i-1][0]+a[i],a[i]);
            dp[i][1] = Math.max(Math.max(dp[i-1][0]+a[i]*x, dp[i-1][1]+a[i]*x),a[i]*x);
            dp[i][2] = Math.max(Math.max(Math.max(dp[i-1][0]+a[i],dp[i-1][1]+a[i]),dp[i-1][2]+a[i]),a[i]);
            max=Math.max(Math.max(Math.max(dp[i][0],dp[i][1]),dp[i][2]),max);
        }

        System.out.println(max);
    }
}


import java.io.*;
import java.util.*;

public class d {
    static class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        public FastScanner(Reader in) {
            br = new BufferedReader(in);
        }

        public FastScanner() {
            this(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }

        int[] nextIntArray(int n) {
            int[] a = new int[n];
            for (int idx = 0; idx < n; idx++) {
                a[idx] = nextInt();
            }
            return a;
        }
    }
    public static void main(String[] args) {

        FastScanner sc = new FastScanner();
        String s = sc.nextLine();
        String[] c = s.split(" ");
        int n = Integer.parseInt(c[0]);
        int x = Integer.parseInt(c[1]);
        String s2 = sc.nextLine();
        String[] cc = s2.split(" ");
        int[] a = new int[n];
        boolean bo = false;
        if(x>0)
        {
            bo=true;
        }
        long m = 0;
        int x1=0,y1=0,x2=0;
        if(!bo){
            long rent = 0;
            for(int i=0;i<n;i++)
            {
                a[i] = Integer.parseInt(cc[i]);
                if(n==1)
                {
                    if(a[i]>0)
                    {
                        System.out.println(a[i]);
                        return;
                    }else
                    {
                        System.out.println((a[i]*x));
                        return;
                    }
                }
                if(rent>0)
                {
                    rent= a[i];
                    //System.out.println(a[i]);
                    x2=i;
                }
                else rent+=a[i];
                if(rent<m)
                {
                    x1=x2;
                    m=rent;
                    y1=i;
                    //System.out.println(x1+" "+m+" "+y1);
                }
            }
            //System.out.println(rent);
        }else
        {
            long rent = 0;
            for(int i=0;i<n;i++)
            {
                a[i] = Integer.parseInt(cc[i]);
                if(n==1)
                {
                    if(a[i]>0)
                    {
                        System.out.println((a[i]*x));
                        return;
                    }else
                    {
                        System.out.println(a[i]);
                        return;
                    }
                }
                if(rent<0)
                {
                    rent= a[i];
                    x2=i;
                }
                else rent+=a[i];
                if(rent>m)
                {
                    x1=x2;
                    m=rent;
                    y1=i;
                }
            }
        }
        if(bo&&m<=0)
        {
            System.out.println(0);
            return;
        }
        if(!bo&&m>=0)
        {
            long sum=0;
            for(int i=0;i<n;i++)
            {
                sum+=a[i];
            }
            System.out.println(sum);
            return;
        }
        for(int i=x1;i<=y1;i++)
        {
            a[i] = a[i]*x;
        }
        long re = 0,max=0;
        for(int i=0;i<n;i++)
        {
            if(re<0)
            {
                re=a[i];
            }
            else re+=a[i];
            if(re>max)
            {
                max=re;
            }
        }
        System.out.println(max);
    }
}


import java.io.*;
import java.util.*;

public class d {
    static class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        public FastScanner(Reader in) {
            br = new BufferedReader(in);
        }

        public FastScanner() {
            this(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }

        int[] nextIntArray(int n) {
            int[] a = new int[n];
            for (int idx = 0; idx < n; idx++) {
                a[idx] = nextInt();
            }
            return a;
        }
    }
    public static void main(String[] args) {

        FastScanner sc = new FastScanner();
        String s = sc.nextLine();
        String[] c = s.split(" ");
        int n = Integer.parseInt(c[0]);
        int x = Integer.parseInt(c[1]);
        String s2 = sc.nextLine();
        String[] cc = s2.split(" ");
        int[] a = new int[n];
        boolean bo = false;
        if(x>0)
        {
            bo=true;
        }
        long m = 0;
        int x1=0,y1=0,x2=0;
        if(!bo){
            long rent = 0;
            for(int i=0;i<n;i++)
            {
                a[i] = Integer.parseInt(cc[i]);

                if(rent>0)
                {
                    rent= a[i];
                    //System.out.println(a[i]);
                    x2=i;
                }
                else rent+=a[i];
                if(rent<m)
                {
                    x1=x2;
                    m=rent;
                    y1=i;
                    //System.out.println(x1+" "+m+" "+y1);
                }
            }
            //System.out.println(rent);
        }else
        {
            long rent = 0;
            for(int i=0;i<n;i++)
            {
                a[i] = Integer.parseInt(cc[i]);
                if(rent<0)
                {
                    rent= a[i];
                    x2=i;
                }
                else rent+=a[i];
                if(rent>m)
                {
                    x1=x2;
                    m=rent;
                    y1=i;
                }
            }
        }
        if(bo&&m<=0)
        {
            System.out.println(0);
            return;
        }
        if(!bo&&m>=0)
        {
            long sum=0;
            for(int i=0;i<n;i++)
            {
                sum+=a[i];
            }
            System.out.println(sum);
            return;
        }
        long re = 0,max1=0,max2=0;
        for(int i=x1-1;i>=0;i--)
        {
            re+=a[i];
            if(re>max1) max1 = re;
        }
        re=0;
        for(int i=y1+1;i<n;i++)
        {
            re+=a[i];
            if(re>max2) max2 = re;
        }
        long rst = m*x+max1+max2;
        System.out.println(rst);
    }
}


import java.io.*;
import java.util.*;

public class d {
    static class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        public FastScanner(Reader in) {
            br = new BufferedReader(in);
        }

        public FastScanner() {
            this(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }

        int[] nextIntArray(int n) {
            int[] a = new int[n];
            for (int idx = 0; idx < n; idx++) {
                a[idx] = nextInt();
            }
            return a;
        }
    }
    public static void main(String[] args) {

        FastScanner sc = new FastScanner();
        String s = sc.nextLine();
        String[] c = s.split(" ");
        int n = Integer.parseInt(c[0]);
        int x = Integer.parseInt(c[1]);
        String s2 = sc.nextLine();
        String[] cc = s2.split(" ");
        int[] a = new int[n];
        boolean bo = false;
        if(x>0)
        {
            bo=true;
        }
        long m = 0;
        int x1=0,y1=0,x2=0;
        if(!bo){
            long rent = 0;
            for(int i=0;i<n;i++)
            {
                a[i] = Integer.parseInt(cc[i]);
                if(n==1)
                {
                    if(a[i]>0)
                    {
                        System.out.println(a[i]);
                        return;
                    }else
                    {
                        System.out.println((a[i]*x));
                        return;
                    }
                }
                if(rent>0)
                {
                    rent= a[i];
                    //System.out.println(a[i]);
                    x2=i;
                }
                else rent+=a[i];
                if(rent<m)
                {
                    x1=x2;
                    m=rent;
                    y1=i;
                    //System.out.println(x1+" "+m+" "+y1);
                }
            }
            //System.out.println(rent);
        }else
        {
            long rent = 0;
            for(int i=0;i<n;i++)
            {
                a[i] = Integer.parseInt(cc[i]);
                if(n==1)
                {
                    if(a[i]>0)
                    {
                        System.out.println((a[i]*x));
                        return;
                    }else
                    {
                        System.out.println(a[i]);
                        return;
                    }
                }
                if(rent<0)
                {
                    rent= a[i];
                    x2=i;
                }
                else rent+=a[i];
                if(rent>m)
                {
                    x1=x2;
                    m=rent;
                    y1=i;
                }
            }
        }
        if(bo&&m<=0)
        {
            System.out.println(0);
            return;
        }
        if(!bo&&m>=0)
        {
            long sum=0;
            for(int i=0;i<n;i++)
            {
                sum+=a[i];
            }
            System.out.println(sum);
            return;
        }
        long re = 0,max1=0,max2=0;
        for(int i=x1-1;i>=0;i--)
        {
            re+=a[i];
            if(re>max1) max1 = re;
        }
        re=0;
        for(int i=y1+1;i<n;i++)
        {
            re+=a[i];
            if(re>max2) max2 = re;
        }
        long rst = m*x+max1+max2;
        System.out.println(rst);
    }
}


import java.io.*;
import java.util.*;

public class d {
    static class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        public FastScanner(Reader in) {
            br = new BufferedReader(in);
        }

        public FastScanner() {
            this(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }

        int[] nextIntArray(int n) {
            int[] a = new int[n];
            for (int idx = 0; idx < n; idx++) {
                a[idx] = nextInt();
            }
            return a;
        }
    }
    public static void main(String[] args) {

        FastScanner sc = new FastScanner();
        String s = sc.nextLine();
        String[] c = s.split(" ");
        int n = Integer.parseInt(c[0]);
        int x = Integer.parseInt(c[1]);
        String s2 = sc.nextLine();
        String[] cc = s2.split(" ");
        long[] a = new long[n];
        boolean bo = false;
        if(x>0)
        {
            bo=true;
        }
        long m = 0;
        int x1=0,y1=0,x2=0;
        if(!bo){
            long rent = 0;
            for(int i=0;i<n;i++)
            {
                a[i] = Long.parseLong(cc[i]);
                if(n==1)
                {
                    if(a[i]>0)
                    {
                        System.out.println(a[i]);
                        return;
                    }else
                    {
                        System.out.println((a[i]*x));
                        return;
                    }
                }
                if(rent>0)
                {
                    rent= a[i];
                    //System.out.println(a[i]);
                    x2=i;
                }
                else rent+=a[i];
                if(rent<m)
                {
                    x1=x2;
                    m=rent;
                    y1=i;
                    //System.out.println(x1+" "+m+" "+y1);
                }
            }
            //System.out.println(rent);
        }else
        {
            long rent = 0;
            for(int i=0;i<n;i++)
            {
                a[i] = Long.parseLong(cc[i]);
                if(n==1)
                {
                    if(a[i]>0)
                    {
                        System.out.println((a[i]*x));
                        return;
                    }else
                    {
                        System.out.println(a[i]);
                        return;
                    }
                }
                if(rent<0)
                {
                    rent= a[i];
                    x2=i;
                }
                else rent+=a[i];
                if(rent>m)
                {
                    x1=x2;
                    m=rent;
                    y1=i;
                }
            }
        }
        if(bo&&m<=0)
        {
            System.out.println(0);
            return;
        }
        if(!bo&&m>=0)
        {
            long sum=0;
            for(int i=0;i<n;i++)
            {
                sum+=a[i];
            }
            System.out.println(sum);
            return;
        }
        for(int i=x1;i<=y1;i++)
        {
            a[i] = a[i]*x;
            System.out.println(a[i]);
        }
        long re = 0,max=0;
        for(int i=0;i<n;i++)
        {
            if(re<0)
            {
                re=a[i];
            }
            else re+=a[i];
            if(re>max)
            {
                max=re;
            }
        }
        System.out.println(max);
    }
}


import java.io.*;
import java.util.*;

public class d {
    static class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        public FastScanner(Reader in) {
            br = new BufferedReader(in);
        }

        public FastScanner() {
            this(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }

        int[] nextIntArray(int n) {
            int[] a = new int[n];
            for (int idx = 0; idx < n; idx++) {
                a[idx] = nextInt();
            }
            return a;
        }
    }
    public static void main(String[] args) {

        FastScanner sc = new FastScanner();
        String s = sc.nextLine();
        String[] c = s.split(" ");
        int n = Integer.parseInt(c[0]);
        int x = Integer.parseInt(c[1]);
        String s2 = sc.nextLine();
        String[] cc = s2.split(" ");
        long[] a = new long[n];
        for(int i=0;i<n;i++)
        {
            a[i] = Long.parseLong(cc[i]);
        }
        long[][] dp = new long[n][3];
        dp[0][0] = a[0];
        dp[0][1] = a[0]*x;
        dp[0][2] = a[0];
        long max=Math.max(Math.max(dp[0][0],dp[0][1]),dp[0][2]);

        for(int i=1;i<n;i++)
        {
            dp[i][0] = Math.max(dp[i-1][0]+a[i],a[i]);
            dp[i][1] = Math.max(Math.max(dp[i-1][0]+a[i]*x, dp[i-1][1]+a[i]*x),a[i]*x);
            dp[i][2] = Math.max(Math.max(Math.max(dp[i-1][0]+a[i],dp[i-1][1]+a[i]),dp[i-1][2]+a[i]),a[i]);
            max=Math.max(Math.max(Math.max(dp[i][0],dp[i][1]),dp[i][2]),max);
        }

        System.out.println(max);
    }
}


/**
 * Date: 23 Sep, 2019
 * Link:
 *
 * @author Prasad-Chaudhari
 * @linkedIn: https://www.linkedin.com/in/prasad-chaudhari-841655a6/
 * @git: https://github.com/Prasad-Chaudhari
 */
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.util.Arrays;

public class newProgram1 {

    public static void main(String[] args) throws IOException {
        // TODO code application logic here
        FastIO in = new FastIO();
        int n = in.ni();
        int x = in.ni();
        long a[] = in.gla(n);
        if (x <= 0) {
            for (int i = 0; i < n; i++) {
                a[i] *= -1;
            }
            long sum = 0;
            long max_sum = 0;
            int max_l = 0;
            int max_r = -1;
            int start = 0;
            int end = 0;
            for (int i = 0; i < n; i++) {
                sum += a[i];
                if (sum < 0) {
                    sum = 0;
                    start = i + 1;
                    end = i;
                }
                if (max_sum < sum) {
                    max_sum = sum;
                    max_l = start;
                    max_r = end;
                }
                end++;
            }
            // System.out.println(max_l + " " + max_r);
            for (int i = max_l; i <= max_r; i++) {
                a[i] *= x;
            }
            for (int i = 0; i < n; i++) {
                a[i] *= -1;
            }
            sum = 0;
            max_sum = 0;
            for (int i = 0; i < n; i++) {
                sum += a[i];
                if (sum <= 0) {
                    sum = 0;
                }
                max_sum = Math.max(max_sum, sum);
            }
            System.out.println(max_sum);
        } else if (x > 0) {
            long sum = 0;
            long max_sum = 0;
            for (int i = 0; i < n; i++) {
                sum += a[i];
                if (sum < 0) {
                    sum += 0;
                }
                max_sum = Math.max(max_sum, sum);
            }
            System.out.println(max_sum * x);
        }
        in.bw.flush();
    }

    static class FastIO {

        private final BufferedReader br;
        private final BufferedWriter bw;
        private String s[];
        private int index;
        private final StringBuilder sb;

        public FastIO() throws IOException {
            br = new BufferedReader(new InputStreamReader(System.in));
            bw = new BufferedWriter(new OutputStreamWriter(System.out, "UTF-8"));
            s = br.readLine().split(" ");
            sb = new StringBuilder();
            index = 0;
        }

        public int ni() throws IOException {
            return Integer.parseInt(nextToken());
        }

        public double nd() throws IOException {
            return Double.parseDouble(nextToken());
        }

        public long nl() throws IOException {
            return Long.parseLong(nextToken());
        }

        public String next() throws IOException {
            return nextToken();
        }

        public String nli() throws IOException {
            try {
                return br.readLine();
            } catch (IOException ex) {

            }
            return null;
        }

        public int[] gia(int n) throws IOException {
            int a[] = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = ni();
            }
            return a;
        }

        public int[] gia(int n, int start, int end) throws IOException {
            validate(n, start, end);
            int a[] = new int[n];
            for (int i = start; i < end; i++) {
                a[i] = ni();
            }
            return a;
        }

        public double[] gda(int n) throws IOException {
            double a[] = new double[n];
            for (int i = 0; i < n; i++) {
                a[i] = nd();
            }
            return a;
        }

        public double[] gda(int n, int start, int end) throws IOException {
            validate(n, start, end);
            double a[] = new double[n];
            for (int i = start; i < end; i++) {
                a[i] = nd();
            }
            return a;
        }

        public long[] gla(int n) throws IOException {
            long a[] = new long[n];
            for (int i = 0; i < n; i++) {
                a[i] = nl();
            }
            return a;
        }

        public long[] gla(int n, int start, int end) throws IOException {
            validate(n, start, end);
            long a[] = new long[n];
            for (int i = start; i < end; i++) {
                a[i] = nl();
            }
            return a;
        }

        public int[][][] gwtree(int n) throws IOException {
            int m = n - 1;
            int adja[][] = new int[n + 1][];
            int weight[][] = new int[n + 1][];
            int from[] = new int[m];
            int to[] = new int[m];
            int count[] = new int[n + 1];
            int cost[] = new int[n + 1];
            for (int i = 0; i < m; i++) {
                from[i] = i + 1;
                to[i] = ni();
                cost[i] = ni();
                count[from[i]]++;
                count[to[i]]++;
            }
            for (int i = 0; i <= n; i++) {
                adja[i] = new int[count[i]];
                weight[i] = new int[count[i]];
            }
            for (int i = 0; i < m; i++) {
                adja[from[i]][count[from[i]] - 1] = to[i];
                adja[to[i]][count[to[i]] - 1] = from[i];
                weight[from[i]][count[from[i]] - 1] = cost[i];
                weight[to[i]][count[to[i]] - 1] = cost[i];
                count[from[i]]--;
                count[to[i]]--;
            }
            return new int[][][] { adja, weight };
        }

        public int[][][] gwg(int n, int m) throws IOException {
            int adja[][] = new int[n + 1][];
            int weight[][] = new int[n + 1][];
            int from[] = new int[m];
            int to[] = new int[m];
            int count[] = new int[n + 1];
            int cost[] = new int[n + 1];
            for (int i = 0; i < m; i++) {
                from[i] = ni();
                to[i] = ni();
                cost[i] = ni();
                count[from[i]]++;
                count[to[i]]++;
            }
            for (int i = 0; i <= n; i++) {
                adja[i] = new int[count[i]];
                weight[i] = new int[count[i]];
            }
            for (int i = 0; i < m; i++) {
                adja[from[i]][count[from[i]] - 1] = to[i];
                adja[to[i]][count[to[i]] - 1] = from[i];
                weight[from[i]][count[from[i]] - 1] = cost[i];
                weight[to[i]][count[to[i]] - 1] = cost[i];
                count[from[i]]--;
                count[to[i]]--;
            }
            return new int[][][] { adja, weight };
        }

        public int[][] gtree(int n) throws IOException {
            int adja[][] = new int[n + 1][];
            int from[] = new int[n - 1];
            int to[] = new int[n - 1];
            int count[] = new int[n + 1];
            for (int i = 0; i < n - 1; i++) {
                from[i] = i + 1;
                to[i] = ni();
                count[from[i]]++;
                count[to[i]]++;
            }
            for (int i = 0; i <= n; i++) {
                adja[i] = new int[count[i]];
            }
            for (int i = 0; i < n - 1; i++) {
                adja[from[i]][--count[from[i]]] = to[i];
                adja[to[i]][--count[to[i]]] = from[i];
            }
            return adja;
        }

        public int[][] gg(int n, int m) throws IOException {
            int adja[][] = new int[n + 1][];
            int from[] = new int[m];
            int to[] = new int[m];
            int count[] = new int[n + 1];
            for (int i = 0; i < m; i++) {
                from[i] = ni();
                to[i] = ni();
                count[from[i]]++;
                count[to[i]]++;
            }
            for (int i = 0; i <= n; i++) {
                adja[i] = new int[count[i]];
            }
            for (int i = 0; i < m; i++) {
                adja[from[i]][--count[from[i]]] = to[i];
                adja[to[i]][--count[to[i]]] = from[i];
            }
            return adja;
        }

        public void print(String s) throws IOException {
            bw.write(s);
        }

        public void println(String s) throws IOException {
            bw.write(s);
            bw.newLine();
        }

        public void print(int s) throws IOException {
            bw.write(s + "");
        }

        public void println(int s) throws IOException {
            bw.write(s + "");
            bw.newLine();
        }

        public void print(long s) throws IOException {
            bw.write(s + "");
        }

        public void println(long s) throws IOException {
            bw.write(s + "");
            bw.newLine();
        }

        public void print(double s) throws IOException {
            bw.write(s + "");
        }

        public void println(double s) throws IOException {
            bw.write(s + "");
            bw.newLine();
        }

        private String nextToken() throws IndexOutOfBoundsException, IOException {
            if (index == s.length) {
                s = br.readLine().split(" ");
                index = 0;
            }
            return s[index++];
        }

        private void validate(int n, int start, int end) {
            if (start < 0 || end >= n) {
                throw new IllegalArgumentException();
            }
        }
    }

    static class Data implements Comparable<Data> {

        int a, b;

        public Data(int a, int b) {
            this.a = a;
            this.b = b;
        }

        @Override
        public int compareTo(Data o) {
            if (a == o.a) {
                return Integer.compare(b, o.b);
            }
            return Integer.compare(a, o.a);
        }

        public static void sort(int a[]) {
            Data d[] = new Data[a.length];
            for (int i = 0; i < a.length; i++) {
                d[i] = new Data(a[i], 0);
            }
            Arrays.sort(d);
            for (int i = 0; i < a.length; i++) {
                a[i] = d[i].a;
            }
        }
    }
}