#include <bits/stdc++.h>
#include <fstream>

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

using namespace std;

double Fib(double x,double z);
string BinDec(ull x);
string StringInt(ll x);
ull StringInt(string x);
ull BinDec (string x);
ull POWMOD (ull x,ull y,ull mod);
ull POWE(long long , long long);

int main()
{

    ios::sync_with_stdio(false);
    cin.tie(0);

    int n;
    cin>>n;
    while(n--)
    {
        char x[14][14]={};
        int e=0,i,j,c[14][14]={},l[14][14]={},d[14][14]={};
        for(i=4;i<8+4;i++)
            for(j=4;j<8+4;j++)
            {
                cin>>x[i][j];
                if(x[i][j]=='#')c[i][j]=-1;
                if(x[i][j]=='K'&&e==0)
                {
                    e=1;
                    d[i][j]=1;
                    d[i][j]=-1;
                    d[i+2][j+2]=d[i+2][j-2]=d[i-2][j+2]=d[i-2][j-2]=1;
                }
                else if(x[i][j]=='K')
                {
                    l[i][j]=1;
                    l[i][j]=-1;
                    l[i+2][j+2]=l[i+2][j-2]=l[i-2][j+2]=l[i-2][j-2]=1;
                }
            }

        bool ans=0;
        for(i=4;i<8+4;i++)
        {
            for(j=4;j<8+4;j++)
            {
                if(l[i][j]==1||l[i][j]==-1)
                {
                    if(d[i][j]==1||d[i][j]==-1)
                    {
                        if(c[i][j]==0)
                            ans=1;
                    }
                }
            }
        }
        if(ans)cout<<"YES";
        else cout<<"NO";

        cout<<'\n';
    }

    return 0;
}

double Fib(double x,double z){
    int i=0;
    double f=x,r=x,t;
    for(i=2;i<z;i++)
    {
        t=f;
        f+=r;
        r=t;
    }
    return f;

}
string BinDec( ull x){
    string z;
    while(1)
    {
        z+=((x%3)+'0');
        x/=3;
        if(x==0)
            break;
    }
    while(1)
    {
        if(z.size()==30)
            break;
        z+='0';
    }
    reverse(z.begin(),z.end());
    return z;
}
ull BinDec(string x){
    long long i;
    unsigned long long z=1,a=0;
    for(i=x.size()-1;i>=0;i--)
    {
        if(x[i]=='1')
            a+=z;
        if(x[i]=='2')
            a+=(2*z);
        z*=3;
    }
    return a;
}
ull StringInt(string x){
   ull z=0,i;
   for(i=0;i<x.size();i++)
   {
       z*=2;
       z+=(x[i]-'0');
   }
   return z;
}
string StringInt(ll x){
    string z;
    while(x!=0)
    {
        z+=(x%10+'0');
        x/=10;
    }
    reverse(z.begin(),z.end());
    return z;
}
ull POWMOD (ull base,ull exp,ull mod){
    ull res=1;
    while(exp>0){
        if(exp%2==1)
            res=(res*base);
            res%=mod;
        exp/=2;
        base=(base*base);
        base%=mod;
    }
return res%mod;
}
ull POWE(long long base,long long exp){
    ull res=1;
    while(exp>0){
        if(exp%2==1)
            res=(res*base);
        exp/=2;
        base=(base*base);
    }
return res;

}

/*
int s=0,c[1553][1553]={},z;
char a[1550][1550]={};
void lol(char m,int i,int j,int & s)
{

    if(c[i][j+1]==0&&a[i][j+1]==m)
    {
        s++;
        c[i][j+1]=1;
        lol(m,i,j+1,s);
    }
    if(c[i][j-1]==0&&a[i][j-1]==m)
    {
        s++;
        c[i][j-1]=1;
        lol(m,i,j-1,s);
    }
    if(c[i-1][j]==0&&a[i-1][j]==m)
    {
        s++;
        c[i-1][j]=1;
        lol(m,i-1,j,s);
    }
    if(c[i+1][j]==0&&a[i+1][j]==m)
    {
        s++;
        c[i+1][j]=1;
        lol(m,i+1,j,s);
    }
    if(z!=0)
    {
        z--;
        a[i][j]='X';
    }
    return;
}*/


#include <bits/stdc++.h>
#include <fstream>

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

using namespace std;

double Fib(double x,double z);
string BinDec(ull x);
string StringInt(ll x);
ull StringInt(string x);
ull BinDec (string x);
ull POWMOD (ull x,ull y,ull mod);
ull POWE(long long , long long);

char x[14][14]={};
int s=0,ans=0,c[14][14]={};
void lol(int k,int l,int kk,int ll,int &s)
{
    //cout<<s<<endl;
    if(s>=40000)return;
    if(k==k&&l==ll&&c[k][l]==0){
            ans=1;
            return;
    }
    if(k-2>=0)
    {
        if(l-2>=0)
        {
            if(kk-2>=0)
            {
                if(ll-2>=0)
                {
                    s++;
                    lol(k-2,l-2,kk-2,ll-2,s);
                }
                if(ll+2<=7)
                {
                    s++;
                    lol(k-2,l-2,kk-2,ll+2,s);
                }
            }
            if(kk+2>=0)
            {
                if(ll-2>=0)
                {
                    s++;
                    lol(k-2,l-2,kk+2,ll-2,s);
                }
                if(ll+2<=7)
                {
                    s++;
                    lol(k-2,l-2,kk+2,ll+2,s);
                }
            }

        }
        if(l+2<=7)
        {
            if(kk-2>=0)
            {
                if(ll-2>=0)
                {
                    s++;
                    lol(k-2,l+2,kk-2,ll-2,s);
                }
                if(ll+2<=7)
                {
                    s++;
                    lol(k-2,l+2,kk-2,ll+2,s);
                }
            }
            if(kk+2>=0)
            {
                if(ll-2>=0)
                {
                    s++;
                    lol(k-2,l+2,kk+2,ll-2,s);
                }
                if(ll+2<=7)
                {
                    s++;
                    lol(k-2,l+2,kk+2,ll+2,s);
                }
            }
        }
    }
    if(k+2<=7)
    {
        if(l-2>=0)
        {
            if(kk-2>=0)
            {
                if(ll-2>=0)
                {
                    s++;
                    lol(k+2,l-2,kk-2,ll-2,s);
                }
                if(ll+2<=7)
                {
                    s++;
                    lol(k+2,l-2,kk-2,ll+2,s);
                }
            }
            if(kk+2>=0)
            {
                if(ll-2>=0)
                {
                    s++;
                    lol(k+2,l-2,kk+2,ll-2,s);
                }
                if(ll+2<=7)
                {
                    s++;
                    lol(k+2,l-2,kk+2,ll+2,s);
                }
            }

        }
        if(l+2<=7)
        {
            if(kk-2>=0)
            {
                if(ll-2>=0)
                {
                    s++;
                    lol(k+2,l+2,kk-2,ll-2,s);
                }
                if(ll+2<=7)
                {
                    s++;
                    lol(k+2,l+2,kk-2,ll+2,s);
                }
            }
            if(kk+2>=0)
            {
                if(ll-2>=0)
                {
                    s++;
                    lol(k+2,l+2,kk+2,ll-2,s);
                }
                if(ll+2<=7)
                {
                    s++;
                    lol(k+2,l+2,kk+2,ll+2,s);
                }
            }
        }
    }

}

int main()
{

    ios::sync_with_stdio(false);
    cin.tie(0);

    int n;
    cin>>n;
    while(n--)
    {
        memset(c,0,sizeof(c));
        int e=0,i,j,kk,ll,k,l;
        for(i=0;i<8;i++)
            for(j=0;j<8;j++)
            {
                cin>>x[i][j];
                if(x[i][j]=='#')c[i][j]=-1;
                if(x[i][j]=='K'&&e==0)
                {
                    e=1;
                    kk=i;ll=j;
                }
                else if(x[i][j]=='K')
                {
                    k=i;l=j;
                }
            }
        ans=0; s=0;
        lol(k,l,kk,ll,s);
        if(ans)cout<<"YES";
        else cout<<"NO";

        cout<<'\n';
    }

    return 0;
}

double Fib(double x,double z){
    int i=0;
    double f=x,r=x,t;
    for(i=2;i<z;i++)
    {
        t=f;
        f+=r;
        r=t;
    }
    return f;

}
string BinDec( ull x){
    string z;
    while(1)
    {
        z+=((x%3)+'0');
        x/=3;
        if(x==0)
            break;
    }
    while(1)
    {
        if(z.size()==30)
            break;
        z+='0';
    }
    reverse(z.begin(),z.end());
    return z;
}
ull BinDec(string x){
    long long i;
    unsigned long long z=1,a=0;
    for(i=x.size()-1;i>=0;i--)
    {
        if(x[i]=='1')
            a+=z;
        if(x[i]=='2')
            a+=(2*z);
        z*=3;
    }
    return a;
}
ull StringInt(string x){
   ull z=0,i;
   for(i=0;i<x.size();i++)
   {
       z*=2;
       z+=(x[i]-'0');
   }
   return z;
}
string StringInt(ll x){
    string z;
    while(x!=0)
    {
        z+=(x%10+'0');
        x/=10;
    }
    reverse(z.begin(),z.end());
    return z;
}
ull POWMOD (ull base,ull exp,ull mod){
    ull res=1;
    while(exp>0){
        if(exp%2==1)
            res=(res*base);
            res%=mod;
        exp/=2;
        base=(base*base);
        base%=mod;
    }
return res%mod;
}
ull POWE(long long base,long long exp){
    ull res=1;
    while(exp>0){
        if(exp%2==1)
            res=(res*base);
        exp/=2;
        base=(base*base);
    }
return res;

}

/*
int s=0,c[1553][1553]={},z;
char a[1550][1550]={};
void lol(char m,int i,int j,int & s)
{

    if(c[i][j+1]==0&&a[i][j+1]==m)
    {
        s++;
        c[i][j+1]=1;
        lol(m,i,j+1,s);
    }
    if(c[i][j-1]==0&&a[i][j-1]==m)
    {
        s++;
        c[i][j-1]=1;
        lol(m,i,j-1,s);
    }
    if(c[i-1][j]==0&&a[i-1][j]==m)
    {
        s++;
        c[i-1][j]=1;
        lol(m,i-1,j,s);
    }
    if(c[i+1][j]==0&&a[i+1][j]==m)
    {
        s++;
        c[i+1][j]=1;
        lol(m,i+1,j,s);
    }
    if(z!=0)
    {
        z--;
        a[i][j]='X';
    }
    return;
}*/


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 @Ziklon
 */
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 {
    long max(long... item) {
      long ans = 0;
      for (long e : item) ans = Math.max(ans, e);
      return ans;
    }

    public void solve(int testNumber, InputReader in, OutputWriter out) {
      int n = in.readInt(), x = in.readInt();

      long[] dp = new long[3];
      long ans = 0;
      for (int i = 0; i < n; ++i) {
        long y = in.readLong();

        long[] best = new long[3];
        best[0] = max(0L, y + max(0L, dp[0]));
        best[1] = max(0L, y * x + max(0, dp[1], dp[0]));
        best[2] = max(0L, y + max(dp[2], dp[1]));
        ans = Math.max(ans, max(best));
        dp = best;
      }

      out.printLine(ans);
    }
  }

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

    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 readInt() {
      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 - '0';
        c = read();
      } while (!isSpaceChar(c));
      return res * sgn;
    }

    public long readLong() {
      int c = read();
      while (isSpaceChar(c)) {
        c = read();
      }
      int sgn = 1;
      if (c == '-') {
        sgn = -1;
        c = read();
      }
      long res = 0;
      do {
        if (c < '0' || c > '9') {
          throw new InputMismatchException();
        }
        res *= 10;
        res += c - '0';
        c = read();
      } while (!isSpaceChar(c));
      return res * sgn;
    }

    public boolean isSpaceChar(int c) {
      if (filter != null) {
        return filter.isSpaceChar(c);
      }
      return isWhitespace(c);
    }

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

    public interface SpaceCharFilter {
      public boolean isSpaceChar(int ch);
    }
  }

  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);
    }
  }
}


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 @Ziklon
 */
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 {
    long max(long[] item) {
      long ans = 0;
      for (long e : item) ans = Math.max(ans, e);
      return ans;
    }

    public void solve(int testNumber, InputReader in, OutputWriter out) {
      int n = in.readInt(), x = in.readInt();

      long[][] dp = new long[n + 1][3];

      long ans = 0;

      for (int i = 0; i < n; ++i) {
        long y = in.readLong();

        dp[i + 1][0] = max(new long[] {0L, y, dp[i][0] + y});
        dp[i + 1][1] = max(new long[] {0L, y * x, dp[i][1] + y * x, dp[i][0] + y * x});
        dp[i + 1][2] = max(new long[] {0L, y, dp[i][2] + y, dp[i][1] + y});

        ans = Math.max(ans, max(dp[i + 1]));
      }
      out.printLine(ans);
    }
  }

  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;
    private InputReader.SpaceCharFilter filter;

    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 readInt() {
      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 - '0';
        c = read();
      } while (!isSpaceChar(c));
      return res * sgn;
    }

    public long readLong() {
      int c = read();
      while (isSpaceChar(c)) {
        c = read();
      }
      int sgn = 1;
      if (c == '-') {
        sgn = -1;
        c = read();
      }
      long res = 0;
      do {
        if (c < '0' || c > '9') {
          throw new InputMismatchException();
        }
        res *= 10;
        res += c - '0';
        c = read();
      } while (!isSpaceChar(c));
      return res * sgn;
    }

    public boolean isSpaceChar(int c) {
      if (filter != null) {
        return filter.isSpaceChar(c);
      }
      return isWhitespace(c);
    }

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

    public interface SpaceCharFilter {
      public boolean isSpaceChar(int ch);
    }
  }
}


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 @Ziklon
 */
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 {
    long max(long[] item) {
      long ans = 0;
      for (long e : item) ans = Math.max(ans, e);
      return ans;
    }

    public void solve(int testNumber, InputReader in, OutputWriter out) {
      int n = in.readInt(), x = in.readInt();

      long[] dp = new long[3];
      long ans = 0;
      for (int i = 0; i < n; ++i) {
        long y = in.readLong();

        long[] best = new long[3];

        best[0] = max(new long[] {0L, y, dp[0] + y});
        best[1] = max(new long[] {0L, y * x, dp[1] + y * x, dp[0] + y * x});
        best[2] = max(new long[] {0L, y, dp[2] + y, dp[1] + y});
        ans = Math.max(ans, max(best));
        dp = best;
      }

      out.printLine(ans);
    }
  }

  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;
    private InputReader.SpaceCharFilter filter;

    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 readInt() {
      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 - '0';
        c = read();
      } while (!isSpaceChar(c));
      return res * sgn;
    }

    public long readLong() {
      int c = read();
      while (isSpaceChar(c)) {
        c = read();
      }
      int sgn = 1;
      if (c == '-') {
        sgn = -1;
        c = read();
      }
      long res = 0;
      do {
        if (c < '0' || c > '9') {
          throw new InputMismatchException();
        }
        res *= 10;
        res += c - '0';
        c = read();
      } while (!isSpaceChar(c));
      return res * sgn;
    }

    public boolean isSpaceChar(int c) {
      if (filter != null) {
        return filter.isSpaceChar(c);
      }
      return isWhitespace(c);
    }

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

    public interface SpaceCharFilter {
      public boolean isSpaceChar(int ch);
    }
  }
}


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 @Ziklon
 */
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 {
    long max(long... item) {
      long ans = 0;
      for (long e : item) ans = Math.max(ans, e);
      return ans;
    }

    public void solve(int testNumber, InputReader in, OutputWriter out) {
      int n = in.readInt(), x = in.readInt();

      long[] dp = new long[3];
      long ans = 0;
      for (int i = 0; i < n; ++i) {
        long y = in.readLong();
        long[] best = new long[3];
        best[0] = y + max(0L, dp[0]);
        best[1] = y * x + max(0, dp[1], dp[0]);
        best[2] = y + max(dp[2], dp[1]);

        for (int j = 0; j < 3; ++j) {
          best[j] = Math.max(best[j], 0L);
          ans = Math.max(ans, best[j]);
        }
        dp = best;
      }
      out.printLine(ans);
    }
  }

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

    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 readInt() {
      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 - '0';
        c = read();
      } while (!isSpaceChar(c));
      return res * sgn;
    }

    public long readLong() {
      int c = read();
      while (isSpaceChar(c)) {
        c = read();
      }
      int sgn = 1;
      if (c == '-') {
        sgn = -1;
        c = read();
      }
      long res = 0;
      do {
        if (c < '0' || c > '9') {
          throw new InputMismatchException();
        }
        res *= 10;
        res += c - '0';
        c = read();
      } while (!isSpaceChar(c));
      return res * sgn;
    }

    public boolean isSpaceChar(int c) {
      if (filter != null) {
        return filter.isSpaceChar(c);
      }
      return isWhitespace(c);
    }

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

    public interface SpaceCharFilter {
      public boolean isSpaceChar(int ch);
    }
  }

  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);
    }
  }
}


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 @Ziklon
 */
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 {
    long max(long... item) {
      long ans = 0;
      for (long e : item) ans = Math.max(ans, e);
      return ans;
    }

    public void solve(int testNumber, InputReader in, OutputWriter out) {
      int n = in.readInt(), x = in.readInt();

      long[] dp = new long[3];
      long ans = 0;
      for (int i = 0; i < n; ++i) {
        long y = in.readLong();
        long[] best = new long[3];
        best[0] = max(y, dp[0]);
        best[1] = y * x + max(0, dp[1], dp[0]);
        best[2] = y + max(dp[2], dp[1]);

        for (int j = 0; j < 3; ++j) {
          best[j] = Math.max(best[j], 0L);
          ans = Math.max(ans, best[j]);
        }
        dp = best;
      }
      out.printLine(ans);
    }
  }

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

    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 readInt() {
      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 - '0';
        c = read();
      } while (!isSpaceChar(c));
      return res * sgn;
    }

    public long readLong() {
      int c = read();
      while (isSpaceChar(c)) {
        c = read();
      }
      int sgn = 1;
      if (c == '-') {
        sgn = -1;
        c = read();
      }
      long res = 0;
      do {
        if (c < '0' || c > '9') {
          throw new InputMismatchException();
        }
        res *= 10;
        res += c - '0';
        c = read();
      } while (!isSpaceChar(c));
      return res * sgn;
    }

    public boolean isSpaceChar(int c) {
      if (filter != null) {
        return filter.isSpaceChar(c);
      }
      return isWhitespace(c);
    }

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

    public interface SpaceCharFilter {
      public boolean isSpaceChar(int ch);
    }
  }

  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);
    }
  }
}


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

/**
 * Built using CHelper plug-in Actual solution is at the top
 *
 * @author @Ziklon
 */
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 {
    int bestAt = -1;

    public void solve(int testNumber, InputReader in, OutputWriter out) {

      int n = in.readInt(), x = in.readInt();
      long[] seq = in.readLongArray(n);

      long ans = 0;

      if (x >= 1) {
        for (int i = 0; i < n; ++i) seq[i] *= x;
        ans = calculate(seq);
      } else {

        if (ArrayUtils.minElement(seq) < 0 && x < 0) {

          long[] tmp = seq.clone();
          for (int i = 0; i < tmp.length; ++i) tmp[i] *= -1;

          long bestSum = calculate(tmp);
          long tmpSum = 0;
          for (int i = bestAt; i >= 0 && tmpSum != bestSum; --i) {
            tmpSum += tmp[i];
            seq[i] *= x;
          }
        }
        ans = calculate(seq);
      }
      out.printLine(ans);
    }

    long calculate(long[] seq) {
      long max_so_far = 0, max_ending_here = 0;
      for (int i = 0; i < seq.length; i++) {
        max_ending_here = max_ending_here + seq[i];
        if (max_so_far <= max_ending_here) {
          max_so_far = max_ending_here;
          bestAt = i;
        }
        if (max_ending_here < 0) max_ending_here = 0;
      }
      return max_so_far;
    }
  }

  static class LongArray extends LongAbstractStream implements LongList {
    private long[] data;

    public LongArray(long[] arr) {
      data = arr;
    }

    public int size() {
      return data.length;
    }

    public long get(int at) {
      return data[at];
    }

    public void removeAt(int index) {
      throw new UnsupportedOperationException();
    }
  }

  static interface LongIterator {
    public long value() throws NoSuchElementException;

    public boolean advance();

    public boolean isValid();
  }

  static class ArrayUtils {
    public static long minElement(long[] array) {
      return new LongArray(array).min();
    }
  }

  static interface LongList extends LongReversableCollection {
    public abstract long get(int index);

    public abstract void removeAt(int index);

    public default LongIterator longIterator() {
      return new LongIterator() {
        private int at;
        private boolean removed;

        public long value() {
          if (removed) {
            throw new IllegalStateException();
          }
          return get(at);
        }

        public boolean advance() {
          at++;
          removed = false;
          return isValid();
        }

        public boolean isValid() {
          return !removed && at < size();
        }

        public void remove() {
          removeAt(at);
          at--;
          removed = true;
        }
      };
    }
  }

  static interface LongReversableCollection extends LongCollection {}

  static interface LongStream extends Iterable<Long>, Comparable<LongStream> {
    public LongIterator longIterator();

    public default Iterator<Long> iterator() {
      return new Iterator<Long>() {
        private LongIterator it = longIterator();

        public boolean hasNext() {
          return it.isValid();
        }

        public Long next() {
          long result = it.value();
          it.advance();
          return result;
        }
      };
    }

    public default int compareTo(LongStream c) {
      LongIterator it = longIterator();
      LongIterator jt = c.longIterator();
      while (it.isValid() && jt.isValid()) {
        long i = it.value();
        long j = jt.value();
        if (i < j) {
          return -1;
        } else if (i > j) {
          return 1;
        }
        it.advance();
        jt.advance();
      }
      if (it.isValid()) {
        return 1;
      }
      if (jt.isValid()) {
        return -1;
      }
      return 0;
    }

    public default long min() {
      long result = Long.MAX_VALUE;
      for (LongIterator it = longIterator(); it.isValid(); it.advance()) {
        long current = it.value();
        if (current < result) {
          result = current;
        }
      }
      return result;
    }
  }

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

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

    public long[] readLongArray(int size) {
      long[] array = new long[size];
      for (int i = 0; i < size; i++) {
        array[i] = readLong();
      }
      return array;
    }

    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 readInt() {
      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 - '0';
        c = read();
      } while (!isSpaceChar(c));
      return res * sgn;
    }

    public long readLong() {
      int c = read();
      while (isSpaceChar(c)) {
        c = read();
      }
      int sgn = 1;
      if (c == '-') {
        sgn = -1;
        c = read();
      }
      long res = 0;
      do {
        if (c < '0' || c > '9') {
          throw new InputMismatchException();
        }
        res *= 10;
        res += c - '0';
        c = read();
      } while (!isSpaceChar(c));
      return res * sgn;
    }

    public boolean isSpaceChar(int c) {
      if (filter != null) {
        return filter.isSpaceChar(c);
      }
      return isWhitespace(c);
    }

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

    public interface SpaceCharFilter {
      public boolean isSpaceChar(int ch);
    }
  }

  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 interface LongCollection extends LongStream {
    public int size();
  }

  abstract static class LongAbstractStream implements LongStream {
    public String toString() {
      StringBuilder builder = new StringBuilder();
      boolean first = true;
      for (LongIterator it = longIterator(); it.isValid(); it.advance()) {
        if (first) {
          first = false;
        } else {
          builder.append(' ');
        }
        builder.append(it.value());
      }
      return builder.toString();
    }

    public boolean equals(Object o) {
      if (!(o instanceof LongStream)) {
        return false;
      }
      LongStream c = (LongStream) o;
      LongIterator it = longIterator();
      LongIterator jt = c.longIterator();
      while (it.isValid() && jt.isValid()) {
        if (it.value() != jt.value()) {
          return false;
        }
        it.advance();
        jt.advance();
      }
      return !it.isValid() && !jt.isValid();
    }

    public int hashCode() {
      int result = 0;
      for (LongIterator it = longIterator(); it.isValid(); it.advance()) {
        result *= 31;
        result += it.value();
      }
      return result;
    }
  }
}


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 @Ziklon
 */
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 {
    long max(long... item) {
      long ans = 0;
      for (long e : item) ans = Math.max(ans, e);
      return ans;
    }

    public void solve(int testNumber, InputReader in, OutputWriter out) {
      int n = in.readInt(), x = in.readInt();

      long[] dp = new long[3];
      long ans = 0;
      for (int i = 0; i < n; ++i) {
        long y = in.readLong();
        long[] best = new long[3];
        best[0] = max(0L, y + max(0L, dp[0]));
        best[1] = max(0L, y * x + max(0, dp[1], dp[0]));
        best[2] = max(0L, y + max(dp[2], dp[1]));
        ans = Math.max(ans, max(best));
        dp = best;
      }
      out.printLine(ans);
    }
  }

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

    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 readInt() {
      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 - '0';
        c = read();
      } while (!isSpaceChar(c));
      return res * sgn;
    }

    public long readLong() {
      int c = read();
      while (isSpaceChar(c)) {
        c = read();
      }
      int sgn = 1;
      if (c == '-') {
        sgn = -1;
        c = read();
      }
      long res = 0;
      do {
        if (c < '0' || c > '9') {
          throw new InputMismatchException();
        }
        res *= 10;
        res += c - '0';
        c = read();
      } while (!isSpaceChar(c));
      return res * sgn;
    }

    public boolean isSpaceChar(int c) {
      if (filter != null) {
        return filter.isSpaceChar(c);
      }
      return isWhitespace(c);
    }

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

    public interface SpaceCharFilter {
      public boolean isSpaceChar(int ch);
    }
  }

  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);
    }
  }
}


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

/**
 * Built using CHelper plug-in Actual solution is at the top
 *
 * @author @Ziklon
 */
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 {
    int bestAt = -1;

    public void solve(int testNumber, InputReader in, OutputWriter out) {

      int n = in.readInt(), x = in.readInt();
      long[] seq = in.readLongArray(n);

      long[] dp = new long[n];

      long ans = 0;

      if (x >= 1) {
        for (int i = 0; i < n; ++i) seq[i] *= x;
        ans = calculate(seq);
      } else {

        if (x == 0 && ArrayUtils.maxElement(seq) > 0)
          for (int i = 0; i < seq.length; ++i) if (seq[i] < 0) seq[i] = 0;

        if (ArrayUtils.minElement(seq) < 0) {
          long[] tmp = seq.clone();
          for (int i = 0; i < tmp.length; ++i) tmp[i] *= -1;

          long bestSum = calculate(tmp);
          long tmpSum = 0;
          for (int i = bestAt; i >= 0 && tmpSum != bestSum; --i) {
            tmpSum += tmp[i];
            seq[i] *= x;
          }
        }
        ans = calculate(seq);
      }
      out.printLine(ans);
    }

    long calculate(long[] seq) {
      long max_so_far = 0, max_ending_here = 0;
      for (int i = 0; i < seq.length; i++) {
        max_ending_here = max_ending_here + seq[i];
        if (max_so_far <= max_ending_here) {
          max_so_far = max_ending_here;
          bestAt = i;
        }
        if (max_ending_here < 0) max_ending_here = 0;
      }
      return max_so_far;
    }
  }

  static class LongArray extends LongAbstractStream implements LongList {
    private long[] data;

    public LongArray(long[] arr) {
      data = arr;
    }

    public int size() {
      return data.length;
    }

    public long get(int at) {
      return data[at];
    }

    public void removeAt(int index) {
      throw new UnsupportedOperationException();
    }
  }

  static interface LongIterator {
    public long value() throws NoSuchElementException;

    public boolean advance();

    public boolean isValid();
  }

  static class ArrayUtils {
    public static long minElement(long[] array) {
      return new LongArray(array).min();
    }

    public static long maxElement(long[] array) {
      return new LongArray(array).max();
    }
  }

  static interface LongList extends LongReversableCollection {
    public abstract long get(int index);

    public abstract void removeAt(int index);

    public default LongIterator longIterator() {
      return new LongIterator() {
        private int at;
        private boolean removed;

        public long value() {
          if (removed) {
            throw new IllegalStateException();
          }
          return get(at);
        }

        public boolean advance() {
          at++;
          removed = false;
          return isValid();
        }

        public boolean isValid() {
          return !removed && at < size();
        }

        public void remove() {
          removeAt(at);
          at--;
          removed = true;
        }
      };
    }
  }

  static interface LongReversableCollection extends LongCollection {}

  static interface LongStream extends Iterable<Long>, Comparable<LongStream> {
    public LongIterator longIterator();

    public default Iterator<Long> iterator() {
      return new Iterator<Long>() {
        private LongIterator it = longIterator();

        public boolean hasNext() {
          return it.isValid();
        }

        public Long next() {
          long result = it.value();
          it.advance();
          return result;
        }
      };
    }

    public default int compareTo(LongStream c) {
      LongIterator it = longIterator();
      LongIterator jt = c.longIterator();
      while (it.isValid() && jt.isValid()) {
        long i = it.value();
        long j = jt.value();
        if (i < j) {
          return -1;
        } else if (i > j) {
          return 1;
        }
        it.advance();
        jt.advance();
      }
      if (it.isValid()) {
        return 1;
      }
      if (jt.isValid()) {
        return -1;
      }
      return 0;
    }

    public default long min() {
      long result = Long.MAX_VALUE;
      for (LongIterator it = longIterator(); it.isValid(); it.advance()) {
        long current = it.value();
        if (current < result) {
          result = current;
        }
      }
      return result;
    }

    public default long max() {
      long result = Long.MIN_VALUE;
      for (LongIterator it = longIterator(); it.isValid(); it.advance()) {
        long current = it.value();
        if (current > result) {
          result = current;
        }
      }
      return result;
    }
  }

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

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

    public long[] readLongArray(int size) {
      long[] array = new long[size];
      for (int i = 0; i < size; i++) {
        array[i] = readLong();
      }
      return array;
    }

    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 readInt() {
      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 - '0';
        c = read();
      } while (!isSpaceChar(c));
      return res * sgn;
    }

    public long readLong() {
      int c = read();
      while (isSpaceChar(c)) {
        c = read();
      }
      int sgn = 1;
      if (c == '-') {
        sgn = -1;
        c = read();
      }
      long res = 0;
      do {
        if (c < '0' || c > '9') {
          throw new InputMismatchException();
        }
        res *= 10;
        res += c - '0';
        c = read();
      } while (!isSpaceChar(c));
      return res * sgn;
    }

    public boolean isSpaceChar(int c) {
      if (filter != null) {
        return filter.isSpaceChar(c);
      }
      return isWhitespace(c);
    }

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

    public interface SpaceCharFilter {
      public boolean isSpaceChar(int ch);
    }
  }

  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 interface LongCollection extends LongStream {
    public int size();
  }

  abstract static class LongAbstractStream implements LongStream {
    public String toString() {
      StringBuilder builder = new StringBuilder();
      boolean first = true;
      for (LongIterator it = longIterator(); it.isValid(); it.advance()) {
        if (first) {
          first = false;
        } else {
          builder.append(' ');
        }
        builder.append(it.value());
      }
      return builder.toString();
    }

    public boolean equals(Object o) {
      if (!(o instanceof LongStream)) {
        return false;
      }
      LongStream c = (LongStream) o;
      LongIterator it = longIterator();
      LongIterator jt = c.longIterator();
      while (it.isValid() && jt.isValid()) {
        if (it.value() != jt.value()) {
          return false;
        }
        it.advance();
        jt.advance();
      }
      return !it.isValid() && !jt.isValid();
    }

    public int hashCode() {
      int result = 0;
      for (LongIterator it = longIterator(); it.isValid(); it.advance()) {
        result *= 31;
        result += it.value();
      }
      return result;
    }
  }
}


import java.util.*;
import java.io.*;
import static java.lang.Math.*;
public class Main {
    static final long MOD = 1_000_000_007 , INF = 1_000_000_000_000_000L;
    static final int INf = 1_000_000_000;
    static FastReader reader;
    static PrintWriter writer;
    public static void main(String[] args) {
        Thread t = new Thread(null, new O(), "Integer.MAX_VALUE", 100000000);
        t.start();
    }
    static class O implements Runnable {
        public void run() {
            try {
                magic();
            }
            catch (Exception e) {
                e.printStackTrace();
                System.exit(1);
            }
        }
    }
    static class FastReader {
        final private int BUFFER_SIZE = 1 << 16;
        private DataInputStream din;
        private byte[] buffer;
        private int bufferPointer, bytesRead;

        public FastReader() {
            din = new DataInputStream(System.in);
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }

        public FastReader(String file_name) throws IOException {
            din = new DataInputStream(new FileInputStream(file_name));
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }

        public String readLine() throws IOException {
            byte[] buf = new byte[1000000];
            int cnt = 0, c;
            while ((c = read()) != -1) {
                if (c == '\n') break;
                buf[cnt++] = (byte) c;
            }
            return new String(buf, 0, cnt);
        }

        public int nextInt() throws IOException {
            int ret = 0;
            byte c = read();
            while (c <= ' ') c = read();
            boolean neg = (c == '-');
            if (neg) c = read();
            do {
                ret = ret * 10 + c - '0';
            } while ((c = read()) >= '0' && c <= '9');
            if (neg) return -ret;
            return ret;
        }

        public long nextLong() throws IOException {
            long ret = 0;
            byte c = read();
            while (c <= ' ') c = read();
            boolean neg = (c == '-');
            if (neg) c = read();
            do {
                ret = ret * 10 + c - '0';
            } while ((c = read()) >= '0' && c <= '9');
            if (neg) return -ret;
            return ret;
        }

        public double nextDouble() throws IOException {
            double ret = 0, div = 1;
            byte c = read();
            while (c <= ' ') c = read();
            boolean neg = (c == '-');
            if (neg) c = read();
            do {
                ret = ret * 10 + c - '0';
            } while ((c = read()) >= '0' && c <= '9');
            if (c == '.') while ((c = read()) >= '0' && c <= '9') ret += (c - '0') / (div *= 10);
            if (neg) return -ret;
            return ret;
        }

        private void fillBuffer() throws IOException {
            bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
            if (bytesRead == -1) buffer[0] = -1;
        }

        private byte read() throws IOException {
            if (bufferPointer == bytesRead) fillBuffer();
            return buffer[bufferPointer++];
        }

        public void close() throws IOException {
            if (din == null) return;
            din.close();
        }
    }

    static void magic() throws IOException {
        reader = new FastReader();
        writer = new PrintWriter(System.out, true);
        int n = reader.nextInt();
        long x = reader.nextLong();
        long arr[] = new long[n];
        for(int i=0;i<n;++i) {
            arr[i] = reader.nextInt();
        }
        if(x>=0) {
            long max = findMax(arr, n);
            writer.println(max(max, max*x));
        }
        else {
            long max_ending_at[] = new long[n];
            long max_starting_at[] = new long[n];
            long pref[] = new long[n];
            long min = 0;
            for(int i=0;i<n;++i) {
                pref[i]+=arr[i];
                if(i>0) {
                    pref[i]+=pref[i-1];
                }
                max_ending_at[i] = pref[i] - min;
                min = min(min, pref[i]);
            }
            long max = Long.MIN_VALUE;
            for(int i=n-1;i>=0;--i) {
                max = max(max, pref[i]);
                max_starting_at[i] = max - (i==0 ? 0 : pref[i-1]);
            }
//            writer.println("Max ending at array: ");
//            for(int i=0;i<n;++i) {
//                writer.print(max_ending_at[i]+" ");
//            }
//            writer.println();
//            writer.println("Max starting at array: ");
//            for(int i=0;i<n;++i) {
//                writer.print(max_starting_at[i]+" ");
//            }
//            writer.println();
            long ans = findMax(arr,n);
            min = Long.MAX_VALUE;
            int at = -1;
            for(int i=n-1;i>=0;--i) {
                if(min>pref[i]) {
                    min = pref[i];
                    at = i;
                }
                long ispe = max(0, (i==0 ? 0 : max_ending_at[i-1]));
                ispe+=(min - (i==0 ? 0 : pref[i-1])) * x;
                if(at+1<n) {
                    ispe+= max(0, max_starting_at[at+1]);
                }
                //writer.println("i: "+i+" ispe: "+ispe);
                ans = max(ans, ispe);
            }
            writer.println(ans);
        }
    }
    static long findMax(long arr[], long n) {
        long max = 0, sum = 0;
        for(int i=0;i<n;++i) {
            sum+=arr[i];
            max = max(max, sum);
            if(sum<0) {
                sum = 0;
            }
        }
        return max;
    }
}


import java.util.*;
import java.io.*;
import static java.lang.Math.*;
public class Main {
    static final long MOD = 1_000_000_007 , INF = 1_000_000_000_000_000L;
    static final int INf = 1_000_000_000;
    static FastReader reader;
    static PrintWriter writer;
    public static void main(String[] args) {
        Thread t = new Thread(null, new O(), "Integer.MAX_VALUE", 100000000);
        t.start();
    }
    static class O implements Runnable {
        public void run() {
            try {
                magic();
            }
            catch (Exception e) {
                e.printStackTrace();
                System.exit(1);
            }
        }
    }
    static class FastReader {
        final private int BUFFER_SIZE = 1 << 16;
        private DataInputStream din;
        private byte[] buffer;
        private int bufferPointer, bytesRead;

        public FastReader() {
            din = new DataInputStream(System.in);
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }

        public FastReader(String file_name) throws IOException {
            din = new DataInputStream(new FileInputStream(file_name));
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }

        public String readLine() throws IOException {
            byte[] buf = new byte[1000000];
            int cnt = 0, c;
            while ((c = read()) != -1) {
                if (c == '\n') break;
                buf[cnt++] = (byte) c;
            }
            return new String(buf, 0, cnt);
        }

        public int nextInt() throws IOException {
            int ret = 0;
            byte c = read();
            while (c <= ' ') c = read();
            boolean neg = (c == '-');
            if (neg) c = read();
            do {
                ret = ret * 10 + c - '0';
            } while ((c = read()) >= '0' && c <= '9');
            if (neg) return -ret;
            return ret;
        }

        public long nextLong() throws IOException {
            long ret = 0;
            byte c = read();
            while (c <= ' ') c = read();
            boolean neg = (c == '-');
            if (neg) c = read();
            do {
                ret = ret * 10 + c - '0';
            } while ((c = read()) >= '0' && c <= '9');
            if (neg) return -ret;
            return ret;
        }

        public double nextDouble() throws IOException {
            double ret = 0, div = 1;
            byte c = read();
            while (c <= ' ') c = read();
            boolean neg = (c == '-');
            if (neg) c = read();
            do {
                ret = ret * 10 + c - '0';
            } while ((c = read()) >= '0' && c <= '9');
            if (c == '.') while ((c = read()) >= '0' && c <= '9') ret += (c - '0') / (div *= 10);
            if (neg) return -ret;
            return ret;
        }

        private void fillBuffer() throws IOException {
            bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
            if (bytesRead == -1) buffer[0] = -1;
        }

        private byte read() throws IOException {
            if (bufferPointer == bytesRead) fillBuffer();
            return buffer[bufferPointer++];
        }

        public void close() throws IOException {
            if (din == null) return;
            din.close();
        }
    }

    static void magic() throws IOException {
        reader = new FastReader();
        writer = new PrintWriter(System.out, true);
        int n = reader.nextInt();
        long x = reader.nextLong();
        long arr[] = new long[n];
        for(int i=0;i<n;++i) {
            arr[i] = reader.nextInt();
        }
        if(x>0) {
            long max = findMax(arr, n);
            for(int i=0;i<n;++i) {
                arr[i]*=x;
            }
            max = max(max, findMax(arr, n));
            writer.println(max);
        }
        else {
            long max_ending_at[] = new long[n];
            long max_starting_at[] = new long[n];
            long pref[] = new long[n];
            long min = 0;
            for(int i=0;i<n;++i) {
                pref[i]+=arr[i];
                if(i>0) {
                    pref[i]+=pref[i-1];
                }
                max_ending_at[i] = pref[i] - min;
                min = min(min, pref[i]);
            }
            long max = Long.MIN_VALUE;
            for(int i=n-1;i>=0;--i) {
                max = max(max, pref[i]);
                max_starting_at[i] = max - (i==0 ? 0 : pref[i-1]);
            }
//            writer.println("Max ending at array: ");
//            for(int i=0;i<n;++i) {
//                writer.print(max_ending_at[i]+" ");
//            }
//            writer.println();
//            writer.println("Max starting at array: ");
//            for(int i=0;i<n;++i) {
//                writer.print(max_starting_at[i]+" ");
//            }
//            writer.println();
//            long ans = findMax(arr,n);
//            min = Long.MAX_VALUE;
//            int at = -1;
//            for(int i=n-1;i>=0;--i) {
//                if(min>pref[i]) {
//                    min = pref[i];
//                    at = i;
//                }
//                long ispe = max(0, (i==0 ? 0 : max_ending_at[i-1]));
//                ispe+=(min - (i==0 ? 0 : pref[i-1])) * x;
//                if(at+1<n) {
//                    ispe+= max(0, max_starting_at[at+1]);
//                }
//                //writer.println("i: "+i+" ispe: "+ispe);
//                ans = max(ans, ispe);
//            }
//            writer.println(ans);
            min = Long.MAX_VALUE;
            int at = -1;
            int start = -1, end = -1;
            long min_subarray_sum = Long.MAX_VALUE;
            for(int i=n-1;i>=0;--i) {
                if(min>pref[i]) {
                    min = pref[i];
                    at = i;
                }
                long ispe = min - (i==0?0:pref[i-1]);
                if(ispe<min_subarray_sum) {
                    min_subarray_sum = ispe;
                    start = i;
                    end = at;
                }
            }
            //writer.println("start: "+start+" end: "+end);
            long ans = findMax(arr, n);
            for(int i=start;i<=end;++i) {
                arr[i]*=x;
            }
            ans = max(ans, findMax(arr,n));
            writer.println(ans);
        }
    }
    static long findMax(long arr[], long n) {
        long max = 0, sum = 0;
        for(int i=0;i<n;++i) {
            sum+=arr[i];
            max = max(max, sum);
            if(sum<0) {
                sum = 0;
            }
        }
        return max;
    }
}


import java.util.*;
import java.io.*;
import static java.lang.Math.*;
public class Main {
    static final long MOD = 1_000_000_007 , INF = 1_000_000_000_000_000L;
    static final int INf = 1_000_000_000;
    static FastReader reader;
    static PrintWriter writer;
    public static void main(String[] args) {
        Thread t = new Thread(null, new O(), "Integer.MAX_VALUE", 100000000);
        t.start();
    }
    static class O implements Runnable {
        public void run() {
            try {
                magic();
            }
            catch (Exception e) {
                e.printStackTrace();
                System.exit(1);
            }
        }
    }
    static class FastReader {
        final private int BUFFER_SIZE = 1 << 16;
        private DataInputStream din;
        private byte[] buffer;
        private int bufferPointer, bytesRead;

        public FastReader() {
            din = new DataInputStream(System.in);
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }

        public FastReader(String file_name) throws IOException {
            din = new DataInputStream(new FileInputStream(file_name));
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }

        public String readLine() throws IOException {
            byte[] buf = new byte[1000000];
            int cnt = 0, c;
            while ((c = read()) != -1) {
                if (c == '\n') break;
                buf[cnt++] = (byte) c;
            }
            return new String(buf, 0, cnt);
        }

        public int nextInt() throws IOException {
            int ret = 0;
            byte c = read();
            while (c <= ' ') c = read();
            boolean neg = (c == '-');
            if (neg) c = read();
            do {
                ret = ret * 10 + c - '0';
            } while ((c = read()) >= '0' && c <= '9');
            if (neg) return -ret;
            return ret;
        }

        public long nextLong() throws IOException {
            long ret = 0;
            byte c = read();
            while (c <= ' ') c = read();
            boolean neg = (c == '-');
            if (neg) c = read();
            do {
                ret = ret * 10 + c - '0';
            } while ((c = read()) >= '0' && c <= '9');
            if (neg) return -ret;
            return ret;
        }

        public double nextDouble() throws IOException {
            double ret = 0, div = 1;
            byte c = read();
            while (c <= ' ') c = read();
            boolean neg = (c == '-');
            if (neg) c = read();
            do {
                ret = ret * 10 + c - '0';
            } while ((c = read()) >= '0' && c <= '9');
            if (c == '.') while ((c = read()) >= '0' && c <= '9') ret += (c - '0') / (div *= 10);
            if (neg) return -ret;
            return ret;
        }

        private void fillBuffer() throws IOException {
            bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
            if (bytesRead == -1) buffer[0] = -1;
        }

        private byte read() throws IOException {
            if (bufferPointer == bytesRead) fillBuffer();
            return buffer[bufferPointer++];
        }

        public void close() throws IOException {
            if (din == null) return;
            din.close();
        }
    }

    static void magic() throws IOException {
        reader = new FastReader();
        writer = new PrintWriter(System.out, true);
        int n = reader.nextInt();
        long x = reader.nextLong();
        long arr[] = new long[n];
        for(int i=0;i<n;++i) {
            arr[i] = reader.nextInt();
        }
        if(x>=0) {
            long max = findMax(arr, n);
            writer.println(max(max, max*x));
        }
        else {
            long max_ending_at[] = new long[n];
            long max_starting_at[] = new long[n];
            long pref[] = new long[n];
            long min = 0;
            for(int i=0;i<n;++i) {
                pref[i]+=arr[i];
                if(i>0) {
                    pref[i]+=pref[i-1];
                }
                max_ending_at[i] = pref[i] - min;
                min = min(min, pref[i]);
            }
            long max = Long.MIN_VALUE;
            for(int i=n-1;i>=0;--i) {
                max = max(max, pref[i]);
                max_starting_at[i] = max - (i==0 ? 0 : pref[i-1]);
            }
//            writer.println("Max ending at array: ");
//            for(int i=0;i<n;++i) {
//                writer.print(max_ending_at[i]+" ");
//            }
//            writer.println();
//            writer.println("Max starting at array: ");
//            for(int i=0;i<n;++i) {
//                writer.print(max_starting_at[i]+" ");
//            }
//            writer.println();
//            long ans = findMax(arr,n);
//            min = Long.MAX_VALUE;
//            int at = -1;
//            for(int i=n-1;i>=0;--i) {
//                if(min>pref[i]) {
//                    min = pref[i];
//                    at = i;
//                }
//                long ispe = max(0, (i==0 ? 0 : max_ending_at[i-1]));
//                ispe+=(min - (i==0 ? 0 : pref[i-1])) * x;
//                if(at+1<n) {
//                    ispe+= max(0, max_starting_at[at+1]);
//                }
//                //writer.println("i: "+i+" ispe: "+ispe);
//                ans = max(ans, ispe);
//            }
//            writer.println(ans);
            min = Long.MAX_VALUE;
            int at = -1;
            int start = -1, end = -1;
            long min_subarray_sum = Long.MAX_VALUE;
            for(int i=n-1;i>=0;--i) {
                if(min>pref[i]) {
                    min = pref[i];
                    at = i;
                }
                long ispe = min - (i==0?0:pref[i-1]);
                if(ispe<min_subarray_sum) {
                    min_subarray_sum = ispe;
                    start = i;
                    end = at;
                }
            }
            //writer.println("start: "+start+" end: "+end);
            long ans = findMax(arr, n);
            for(int i=start;i<=end;++i) {
                arr[i]*=x;
            }
            ans = max(ans, findMax(arr,n));
            writer.println(ans);
        }
    }
    static long findMax(long arr[], long n) {
        long max = 0, sum = 0;
        for(int i=0;i<n;++i) {
            sum+=arr[i];
            max = max(max, sum);
            if(sum<0) {
                sum = 0;
            }
        }
        return max;
    }
}


import java.util.*;
import java.io.*;
import static java.lang.Math.*;
public class Main {
    static final long MOD = 1_000_000_007 , INF = 1_000_000_000_000_000L;
    static final int INf = 1_000_000_000;
    static FastReader reader;
    static PrintWriter writer;
    public static void main(String[] args) {
        Thread t = new Thread(null, new O(), "Integer.MAX_VALUE", 100000000);
        t.start();
    }
    static class O implements Runnable {
        public void run() {
            try {
                magic();
            }
            catch (Exception e) {
                e.printStackTrace();
                System.exit(1);
            }
        }
    }
    static class FastReader {
        final private int BUFFER_SIZE = 1 << 16;
        private DataInputStream din;
        private byte[] buffer;
        private int bufferPointer, bytesRead;

        public FastReader() {
            din = new DataInputStream(System.in);
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }

        public FastReader(String file_name) throws IOException {
            din = new DataInputStream(new FileInputStream(file_name));
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }

        public String readLine() throws IOException {
            byte[] buf = new byte[1000000];
            int cnt = 0, c;
            while ((c = read()) != -1) {
                if (c == '\n') break;
                buf[cnt++] = (byte) c;
            }
            return new String(buf, 0, cnt);
        }

        public int nextInt() throws IOException {
            int ret = 0;
            byte c = read();
            while (c <= ' ') c = read();
            boolean neg = (c == '-');
            if (neg) c = read();
            do {
                ret = ret * 10 + c - '0';
            } while ((c = read()) >= '0' && c <= '9');
            if (neg) return -ret;
            return ret;
        }

        public long nextLong() throws IOException {
            long ret = 0;
            byte c = read();
            while (c <= ' ') c = read();
            boolean neg = (c == '-');
            if (neg) c = read();
            do {
                ret = ret * 10 + c - '0';
            } while ((c = read()) >= '0' && c <= '9');
            if (neg) return -ret;
            return ret;
        }

        public double nextDouble() throws IOException {
            double ret = 0, div = 1;
            byte c = read();
            while (c <= ' ') c = read();
            boolean neg = (c == '-');
            if (neg) c = read();
            do {
                ret = ret * 10 + c - '0';
            } while ((c = read()) >= '0' && c <= '9');
            if (c == '.') while ((c = read()) >= '0' && c <= '9') ret += (c - '0') / (div *= 10);
            if (neg) return -ret;
            return ret;
        }

        private void fillBuffer() throws IOException {
            bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
            if (bytesRead == -1) buffer[0] = -1;
        }

        private byte read() throws IOException {
            if (bufferPointer == bytesRead) fillBuffer();
            return buffer[bufferPointer++];
        }

        public void close() throws IOException {
            if (din == null) return;
            din.close();
        }
    }

    static void magic() throws IOException {
        reader = new FastReader();
        writer = new PrintWriter(System.out, true);
        int n = reader.nextInt();
        long x = reader.nextLong();
        long arr[] = new long[n];
        for(int i=0;i<n;++i) {
            arr[i] = reader.nextInt();
        }
        if(x>0) {
            long max = findMax(arr, n);
            max = max(max, max*x);
            writer.println(max);
        }
        else {
            long max_ending_at[] = new long[n];
            long max_starting_at[] = new long[n];
            long pref[] = new long[n];
            long min = 0;
            for(int i=0;i<n;++i) {
                pref[i]+=arr[i];
                if(i>0) {
                    pref[i]+=pref[i-1];
                }
                max_ending_at[i] = pref[i] - min;
                min = min(min, pref[i]);
            }
            long max = Long.MIN_VALUE;
            for(int i=n-1;i>=0;--i) {
                max = max(max, pref[i]);
                max_starting_at[i] = max - (i==0 ? 0 : pref[i-1]);
            }
//            writer.println("Max ending at array: ");
//            for(int i=0;i<n;++i) {
//                writer.print(max_ending_at[i]+" ");
//            }
//            writer.println();
//            writer.println("Max starting at array: ");
//            for(int i=0;i<n;++i) {
//                writer.print(max_starting_at[i]+" ");
//            }
//            writer.println();
            long ans = findMax(arr,n);
            max = Long.MIN_VALUE;
            for(int i=n-1;i>=0;--i) {
                max = max(max, pref[i]*x + (i+1==n ? 0 : max(0, max_starting_at[i+1])));
                long ispe = max(0, (i==0 ? 0 : max_ending_at[i-1]));
                //writer.println("i: "+i+" ispe: "+ispe);
                ispe+=max - (i==0?0:pref[i-1])*x;
//                writer.println("i: "+i+" ispe: "+ispe);
//                writer.println("i: "+i+" ispe: "+ispe);
                ans = max(ans, ispe);
            }
            writer.println(ans);
//            min = Long.MAX_VALUE;
//            int at = -1;
//            int start = -1, end = -1;
//            long min_subarray_sum = Long.MAX_VALUE;
//            for(int i=n-1;i>=0;--i) {
//                if(min>pref[i]) {
//                    min = pref[i];
//                    at = i;
//                }
//                long ispe = min - (i==0 ? 0 : pref[i-1]);
//                if(ispe<min_subarray_sum) {
//                    min_subarray_sum = ispe;
//                    start = i;
//                    end = at;
//                }
//            }
//            //writer.println("start: "+start+" end: "+end);
//            long ans = findMax(arr, n);
//            for(int i=start;i<=end;++i) {
//                arr[i]*=x;
//            }
//            ans = max(ans, findMax(arr,n));
//            writer.println(ans);
        }
    }
    static long findMax(long arr[], long n) {
        long max = 0, sum = 0;
        for(int i=0;i<n;++i) {
            sum+=arr[i];
            max = max(max, sum);
            if(sum<0) {
                sum = 0;
            }
        }
        return max;
    }
}


import javafx.util.Pair;

import static java.lang.Double.parseDouble;
import static java.lang.Integer.parseInt;
import static java.lang.Long.parseLong;
import static java.lang.Math.*;
import static java.lang.System.exit;

import java.io.*;
import java.math.BigInteger;
import java.util.*;
import java.util.stream.Stream;

public class A {

    static BufferedReader in;
    static PrintWriter out;
    static StringTokenizer tok;

    int n, x, a[];
    long dp[][][][][], mx = Long.MIN_VALUE;
    long fun(int i, int isSuming, int wasSumming, int isMultiplyingByX, int wasMultiplyingByX) {
        if (i == n || wasSumming == 1) return 0;
        if(dp[isSuming][wasSumming][isMultiplyingByX][wasMultiplyingByX][i] != mx) return dp[isSuming][wasSumming][isMultiplyingByX][wasMultiplyingByX][i];
        long ans = 0;
        if(isSuming == 0 && isMultiplyingByX == 0) ans = max(ans, fun(i + 1, isSuming, wasSumming, isMultiplyingByX, wasMultiplyingByX));
        if (isSuming == 1) {
            ans = max(ans, fun(i + 1, 0, 1, isMultiplyingByX, wasMultiplyingByX));
            if (isMultiplyingByX == 1) {
                if (wasMultiplyingByX == 0) ans = max(ans, a[i] * x + fun(i + 1, 1, wasSumming, 1, wasMultiplyingByX));
                ans = max(ans, a[i] + fun(i + 1, 1, wasSumming, 0, 1));
            } else {
                ans = max(ans, a[i] + fun(i + 1, 1, wasSumming, 0, wasMultiplyingByX));
                if (wasMultiplyingByX == 0) ans = max(ans, a[i] * x + fun(i + 1, 1, wasSumming, 1, wasMultiplyingByX));
            }
        } else {
            ans = max(ans, a[i] + fun(i + 1, 1, wasSumming, 0, wasMultiplyingByX));
            ans = max(ans, a[i] * x + fun(i + 1, 1, wasSumming, 1, wasMultiplyingByX));
        }
        return dp[isSuming][wasSumming][isMultiplyingByX][wasMultiplyingByX][i] = ans;
    }

    void solve() throws Exception {
        n = nextInt();x = nextInt();
        a = na(n);
        dp = new long[2][2][2][2][n + 5];
        for(int i = 0; i < 2; i++) for(int j = 0; j < 2; j++) for(int k = 0; k < 2; k++) for(int l = 0; l < 2; l++) Arrays.fill(dp[i][j][k][l], mx);
        out.println(fun(0, 0, 0, 0, 0));
    }

    // call it like this: lower_bound(a, x + 1) ( /!\ + 1 )
    public static int lower_bound(int[] a, int v) {
        int low = -1, high = a.length;
        while (high - low > 1) {
            int h = high + low >>> 1;
            if (a[h] >= v) {
                high = h;
            } else {
                low = h;
            }
        }
        return high;
    }

    private long gcd(long a, long b) {
        while (b > 0) {
            long temp = b;
            b = a % b;
            a = temp;
        }
        return a;
    }

    private long lcm(long a, long b) {
        return a * (b / gcd(a, b));
    }

    public static int[] radixSort(int[] f) {
        int[] to = new int[f.length];
        {
            int[] b = new int[65537];
            for (int i = 0; i < f.length; i++) b[1 + (f[i] & 0xffff)]++;
            for (int i = 1; i <= 65536; i++) b[i] += b[i - 1];
            for (int i = 0; i < f.length; i++) to[b[f[i] & 0xffff]++] = f[i];
            int[] d = f;
            f = to;
            to = d;
        }
        {
            int[] b = new int[65537];
            for (int i = 0; i < f.length; i++) b[1 + (f[i] >>> 16)]++;
            for (int i = 1; i <= 65536; i++) b[i] += b[i - 1];
            for (int i = 0; i < f.length; i++) to[b[f[i] >>> 16]++] = f[i];
            int[] d = f;
            f = to;
            to = d;
        }
        return f;
    }

    private int[] na(int n) throws IOException {
        int[] a = new int[n];
        for (int i = 0; i < n; i++) a[i] = nextInt();
        return a;
    }

    private long[] nal(int n) throws IOException {
        long[] a = new long[n];
        for (int i = 0; i < n; i++) a[i] = nextLong();
        return a;
    }

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

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

    double nextDouble() throws IOException {
        return parseDouble(next());
    }

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

    public static void main(String[] args) throws Exception {
        try {
            in = new BufferedReader(new InputStreamReader(System.in));
            out = new PrintWriter(new OutputStreamWriter(System.out));
            //long lStartTime = System.currentTimeMillis();
            new A().solve();
            //long lEndTime = System.currentTimeMillis();
            //out.println("Elapsed time in seconds: " + (double)(lEndTime - lStartTime) / 1000.0);
            in.close();
            out.close();
        } catch (Throwable e) {
            e.printStackTrace();
            exit(1);
        }
    }
}


import javafx.util.Pair;

import static java.lang.Double.parseDouble;
import static java.lang.Integer.parseInt;
import static java.lang.Long.parseLong;
import static java.lang.Math.*;
import static java.lang.System.exit;

import java.io.*;
import java.math.BigInteger;
import java.util.*;
import java.util.stream.Stream;

public class A {

    static BufferedReader in;
    static PrintWriter out;
    static StringTokenizer tok;

    void solve() throws Exception {
        int n = nextInt(), m = nextInt();
        long[] a = nal(n), p = nal(m);
        long gcd = a[1] - a[0];
        for(int i = 1; i < n; i++) gcd = gcd(gcd, a[i] - a[i-1]);
        for(int i = 0; i < m; i++) if(gcd % p[i] == 0) {
            out.println("YES");
            out.println(a[0] + " " + (i+1));
            return;
        }
        out.println("NO");
    }

    // call it like this: lower_bound(a, x + 1) ( /!\ + 1 )
    public static int lower_bound(int[] a, int v) {
        int low = -1, high = a.length;
        while (high - low > 1) {
            int h = high + low >>> 1;
            if (a[h] >= v) {
                high = h;
            } else {
                low = h;
            }
        }
        return high;
    }

    private long gcd(long a, long b) {
        while (b > 0) {
            long temp = b;
            b = a % b;
            a = temp;
        }
        return a;
    }

    private long lcm(long a, long b) {
        return a * (b / gcd(a, b));
    }

    public static int[] radixSort(int[] f) {
        int[] to = new int[f.length];
        {
            int[] b = new int[65537];
            for (int i = 0; i < f.length; i++) b[1 + (f[i] & 0xffff)]++;
            for (int i = 1; i <= 65536; i++) b[i] += b[i - 1];
            for (int i = 0; i < f.length; i++) to[b[f[i] & 0xffff]++] = f[i];
            int[] d = f;
            f = to;
            to = d;
        }
        {
            int[] b = new int[65537];
            for (int i = 0; i < f.length; i++) b[1 + (f[i] >>> 16)]++;
            for (int i = 1; i <= 65536; i++) b[i] += b[i - 1];
            for (int i = 0; i < f.length; i++) to[b[f[i] >>> 16]++] = f[i];
            int[] d = f;
            f = to;
            to = d;
        }
        return f;
    }

    private int[] na(int n) throws IOException {
        int[] a = new int[n];
        for (int i = 0; i < n; i++) a[i] = nextInt();
        return a;
    }

    private long[] nal(int n) throws IOException {
        long[] a = new long[n];
        for (int i = 0; i < n; i++) a[i] = nextLong();
        return a;
    }

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

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

    double nextDouble() throws IOException {
        return parseDouble(next());
    }

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

    public static void main(String[] args) throws Exception {
        try {
            in = new BufferedReader(new InputStreamReader(System.in));
            out = new PrintWriter(new OutputStreamWriter(System.out));
            //long lStartTime = System.currentTimeMillis();
            new A().solve();
            //long lEndTime = System.currentTimeMillis();
            //out.println("Elapsed time in seconds: " + (double)(lEndTime - lStartTime) / 1000.0);
            in.close();
            out.close();
        } catch (Throwable e) {
            e.printStackTrace();
            exit(1);
        }
    }
}


import javafx.util.Pair;

import static java.lang.Double.parseDouble;
import static java.lang.Integer.parseInt;
import static java.lang.Long.parseLong;
import static java.lang.Math.*;
import static java.lang.System.exit;

import java.io.*;
import java.math.BigInteger;
import java.util.*;
import java.util.stream.Stream;

public class A {

    static BufferedReader in;
    static PrintWriter out;
    static StringTokenizer tok;

    int n;
    long dp[][][][][],x, a[], mx = Long.MIN_VALUE;
    long fun(int i, int isSuming, int wasSumming, int isMultiplyingByX, int wasMultiplyingByX) {
        if (i == n || wasSumming == 1) return 0;
        if(dp[isSuming][wasSumming][isMultiplyingByX][wasMultiplyingByX][i] != mx) return dp[isSuming][wasSumming][isMultiplyingByX][wasMultiplyingByX][i];
        long ans = 0;
        if(isSuming == 0 && isMultiplyingByX == 0) ans = max(ans, fun(i + 1, isSuming, wasSumming, isMultiplyingByX, wasMultiplyingByX));
        if (isSuming == 1) {
            ans = max(ans, fun(i + 1, 0, 1, isMultiplyingByX, wasMultiplyingByX));
            if (isMultiplyingByX == 1) {
                if (wasMultiplyingByX == 0) ans = max(ans, a[i] * x + fun(i + 1, 1, wasSumming, 1, wasMultiplyingByX));
                ans = max(ans, a[i] + fun(i + 1, 1, wasSumming, 0, 1));
            } else {
                ans = max(ans, a[i] + fun(i + 1, 1, wasSumming, 0, wasMultiplyingByX));
                if (wasMultiplyingByX == 0) ans = max(ans, a[i] * x + fun(i + 1, 1, wasSumming, 1, wasMultiplyingByX));
            }
        } else {
            ans = max(ans, a[i] + fun(i + 1, 1, wasSumming, 0, wasMultiplyingByX));
            ans = max(ans, a[i] * x + fun(i + 1, 1, wasSumming, 1, wasMultiplyingByX));
        }
        return dp[isSuming][wasSumming][isMultiplyingByX][wasMultiplyingByX][i] = ans;
    }

    void solve() throws Exception {
        n = nextInt();x = nextLong();
        a = nal(n);
        dp = new long[2][2][2][2][n + 5];
        for(int i = 0; i < 2; i++) for(int j = 0; j < 2; j++) for(int k = 0; k < 2; k++) for(int l = 0; l < 2; l++) Arrays.fill(dp[i][j][k][l], mx);
        out.println(fun(0, 0, 0, 0, 0));
    }

    // call it like this: lower_bound(a, x + 1) ( /!\ + 1 )
    public static int lower_bound(int[] a, int v) {
        int low = -1, high = a.length;
        while (high - low > 1) {
            int h = high + low >>> 1;
            if (a[h] >= v) {
                high = h;
            } else {
                low = h;
            }
        }
        return high;
    }

    private long gcd(long a, long b) {
        while (b > 0) {
            long temp = b;
            b = a % b;
            a = temp;
        }
        return a;
    }

    private long lcm(long a, long b) {
        return a * (b / gcd(a, b));
    }

    public static int[] radixSort(int[] f) {
        int[] to = new int[f.length];
        {
            int[] b = new int[65537];
            for (int i = 0; i < f.length; i++) b[1 + (f[i] & 0xffff)]++;
            for (int i = 1; i <= 65536; i++) b[i] += b[i - 1];
            for (int i = 0; i < f.length; i++) to[b[f[i] & 0xffff]++] = f[i];
            int[] d = f;
            f = to;
            to = d;
        }
        {
            int[] b = new int[65537];
            for (int i = 0; i < f.length; i++) b[1 + (f[i] >>> 16)]++;
            for (int i = 1; i <= 65536; i++) b[i] += b[i - 1];
            for (int i = 0; i < f.length; i++) to[b[f[i] >>> 16]++] = f[i];
            int[] d = f;
            f = to;
            to = d;
        }
        return f;
    }

    private int[] na(int n) throws IOException {
        int[] a = new int[n];
        for (int i = 0; i < n; i++) a[i] = nextInt();
        return a;
    }

    private long[] nal(int n) throws IOException {
        long[] a = new long[n];
        for (int i = 0; i < n; i++) a[i] = nextLong();
        return a;
    }

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

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

    double nextDouble() throws IOException {
        return parseDouble(next());
    }

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

    public static void main(String[] args) throws Exception {
        try {
            in = new BufferedReader(new InputStreamReader(System.in));
            out = new PrintWriter(new OutputStreamWriter(System.out));
            //long lStartTime = System.currentTimeMillis();
            new A().solve();
            //long lEndTime = System.currentTimeMillis();
            //out.println("Elapsed time in seconds: " + (double)(lEndTime - lStartTime) / 1000.0);
            in.close();
            out.close();
        } catch (Throwable e) {
            e.printStackTrace();
            exit(1);
        }
    }
}


import javafx.util.Pair;

import static java.lang.Double.parseDouble;
import static java.lang.Integer.parseInt;
import static java.lang.Long.parseLong;
import static java.lang.Math.*;
import static java.lang.System.exit;

import java.io.*;
import java.math.BigInteger;
import java.util.*;
import java.util.stream.Stream;

public class A {

    static BufferedReader in;
    static PrintWriter out;
    static StringTokenizer tok;

    int n;
    long dp[][][][][],x, a[];
    long fun(int i, int isSuming, int wasSumming, int isMultiplyingByX, int wasMultiplyingByX) {
        if (i == n || wasSumming == 1) return 0;
        if(dp[isSuming][wasSumming][isMultiplyingByX][wasMultiplyingByX][i] != -1) return dp[isSuming][wasSumming][isMultiplyingByX][wasMultiplyingByX][i];
        long ans = 0;
        if(isSuming == 0 && isMultiplyingByX == 0) ans = max(ans, fun(i + 1, isSuming, wasSumming, isMultiplyingByX, wasMultiplyingByX));
        if (isSuming == 1) {
            ans = max(ans, fun(i + 1, 0, 1, isMultiplyingByX, wasMultiplyingByX));
            if (isMultiplyingByX == 1) {
                if (wasMultiplyingByX == 0) ans = max(ans, a[i] * x + fun(i + 1, 1, wasSumming, 1, wasMultiplyingByX));
                ans = max(ans, a[i] + fun(i + 1, 1, wasSumming, 0, 1));
            } else {
                ans = max(ans, a[i] + fun(i + 1, 1, wasSumming, 0, wasMultiplyingByX));
                if (wasMultiplyingByX == 0) ans = max(ans, a[i] * x + fun(i + 1, 1, wasSumming, 1, wasMultiplyingByX));
            }
        } else {
            ans = max(ans, a[i] + fun(i + 1, 1, wasSumming, 0, wasMultiplyingByX));
            ans = max(ans, a[i] * x + fun(i + 1, 1, wasSumming, 1, wasMultiplyingByX));
        }
        return dp[isSuming][wasSumming][isMultiplyingByX][wasMultiplyingByX][i] = ans;
    }

    void solve() throws Exception {
        n = nextInt();x = nextLong();
        a = nal(n);
        dp = new long[2][2][2][2][n + 5];
        for(int i = 0; i < 2; i++) for(int j = 0; j < 2; j++) for(int k = 0; k < 2; k++) for(int l = 0; l < 2; l++) Arrays.fill(dp[i][j][k][l], -1);
        out.println(fun(0, 0, 0, 0, 0));
    }

    // call it like this: lower_bound(a, x + 1) ( /!\ + 1 )
    public static int lower_bound(int[] a, int v) {
        int low = -1, high = a.length;
        while (high - low > 1) {
            int h = high + low >>> 1;
            if (a[h] >= v) {
                high = h;
            } else {
                low = h;
            }
        }
        return high;
    }

    private long gcd(long a, long b) {
        while (b > 0) {
            long temp = b;
            b = a % b;
            a = temp;
        }
        return a;
    }

    private long lcm(long a, long b) {
        return a * (b / gcd(a, b));
    }

    public static int[] radixSort(int[] f) {
        int[] to = new int[f.length];
        {
            int[] b = new int[65537];
            for (int i = 0; i < f.length; i++) b[1 + (f[i] & 0xffff)]++;
            for (int i = 1; i <= 65536; i++) b[i] += b[i - 1];
            for (int i = 0; i < f.length; i++) to[b[f[i] & 0xffff]++] = f[i];
            int[] d = f;
            f = to;
            to = d;
        }
        {
            int[] b = new int[65537];
            for (int i = 0; i < f.length; i++) b[1 + (f[i] >>> 16)]++;
            for (int i = 1; i <= 65536; i++) b[i] += b[i - 1];
            for (int i = 0; i < f.length; i++) to[b[f[i] >>> 16]++] = f[i];
            int[] d = f;
            f = to;
            to = d;
        }
        return f;
    }

    private int[] na(int n) throws IOException {
        int[] a = new int[n];
        for (int i = 0; i < n; i++) a[i] = nextInt();
        return a;
    }

    private long[] nal(int n) throws IOException {
        long[] a = new long[n];
        for (int i = 0; i < n; i++) a[i] = nextLong();
        return a;
    }

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

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

    double nextDouble() throws IOException {
        return parseDouble(next());
    }

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

    public static void main(String[] args) throws Exception {
        try {
            in = new BufferedReader(new InputStreamReader(System.in));
            out = new PrintWriter(new OutputStreamWriter(System.out));
            //long lStartTime = System.currentTimeMillis();
            new A().solve();
            //long lEndTime = System.currentTimeMillis();
            //out.println("Elapsed time in seconds: " + (double)(lEndTime - lStartTime) / 1000.0);
            in.close();
            out.close();
        } catch (Throwable e) {
            e.printStackTrace();
            exit(1);
        }
    }
}


import javafx.util.Pair;

import static java.lang.Double.parseDouble;
import static java.lang.Integer.parseInt;
import static java.lang.Long.parseLong;
import static java.lang.Math.*;
import static java.lang.System.exit;

import java.io.*;
import java.math.BigInteger;
import java.util.*;
import java.util.stream.Stream;

public class A {

    static BufferedReader in;
    static PrintWriter out;
    static StringTokenizer tok;

    int n;
    long dp[][][][][],x, a[];
    long fun(int i, int b, int c, int d, int e) {
        if (i == n || c == 1) return 0;
        if(dp[b][c][d][e][i] != -1) return dp[b][c][d][e][i];
        long ans = 0;
        if(b == 0 && d == 0) ans = max(ans, fun(i + 1, b, c, d, e));
        if (b == 1) {
            ans = max(ans, fun(i + 1, 0, 1, d, e));
            if (e == 0) ans = max(ans, a[i] * x + fun(i + 1, 1, c, 1, e));
            ans = max(ans, a[i] + fun(i + 1, 1, c, 0, d == 1 ? 1 : e));
        } else {
            ans = max(ans, a[i] + fun(i + 1, 1, c, 0, e));
            ans = max(ans, a[i] * x + fun(i + 1, 1, c, 1, e));
        }
        return dp[b][c][d][e][i] = ans;
    }

    void solve() throws Exception {
        n = nextInt();x = nextLong();
        a = nal(n);
        dp = new long[2][2][2][2][n + 5];
        for(int i = 0; i < 2; i++) for(int j = 0; j < 2; j++) for(int k = 0; k < 2; k++) for(int l = 0; l < 2; l++) Arrays.fill(dp[i][j][k][l], -1);
        out.println(fun(0, 0, 0, 0, 0));
    }

    // call it like this: lower_bound(a, x + 1) ( /!\ + 1 )
    public static int lower_bound(int[] a, int v) {
        int low = -1, high = a.length;
        while (high - low > 1) {
            int h = high + low >>> 1;
            if (a[h] >= v) {
                high = h;
            } else {
                low = h;
            }
        }
        return high;
    }

    private long gcd(long a, long b) {
        while (b > 0) {
            long temp = b;
            b = a % b;
            a = temp;
        }
        return a;
    }

    private long lcm(long a, long b) {
        return a * (b / gcd(a, b));
    }

    public static int[] radixSort(int[] f) {
        int[] to = new int[f.length];
        {
            int[] b = new int[65537];
            for (int i = 0; i < f.length; i++) b[1 + (f[i] & 0xffff)]++;
            for (int i = 1; i <= 65536; i++) b[i] += b[i - 1];
            for (int i = 0; i < f.length; i++) to[b[f[i] & 0xffff]++] = f[i];
            int[] d = f;
            f = to;
            to = d;
        }
        {
            int[] b = new int[65537];
            for (int i = 0; i < f.length; i++) b[1 + (f[i] >>> 16)]++;
            for (int i = 1; i <= 65536; i++) b[i] += b[i - 1];
            for (int i = 0; i < f.length; i++) to[b[f[i] >>> 16]++] = f[i];
            int[] d = f;
            f = to;
            to = d;
        }
        return f;
    }

    private int[] na(int n) throws IOException {
        int[] a = new int[n];
        for (int i = 0; i < n; i++) a[i] = nextInt();
        return a;
    }

    private long[] nal(int n) throws IOException {
        long[] a = new long[n];
        for (int i = 0; i < n; i++) a[i] = nextLong();
        return a;
    }

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

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

    double nextDouble() throws IOException {
        return parseDouble(next());
    }

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

    public static void main(String[] args) throws Exception {
        try {
            in = new BufferedReader(new InputStreamReader(System.in));
            out = new PrintWriter(new OutputStreamWriter(System.out));
            //long lStartTime = System.currentTimeMillis();
            new A().solve();
            //long lEndTime = System.currentTimeMillis();
            //out.println("Elapsed time in seconds: " + (double)(lEndTime - lStartTime) / 1000.0);
            in.close();
            out.close();
        } catch (Throwable e) {
            e.printStackTrace();
            exit(1);
        }
    }
}