import java.io.*;
import java.util.*;
public class gfg{

       public static void main(String[] args){
           PrintWriter out = new PrintWriter(System.out);
            int n = ni();
            int m = ni();
            char ch[][] = new char[n][m];
            int c[][] = new int[n][m];

                for(int i=0;i<n;i++)
                    ch[i] = sc.next().toCharArray();

                for(int i=0;i<n;i++){
                     int ct=0;
                     if(ch[i][m-1]=='1'){
                          c[i][m-1]=1;
                          ct=1;
                       }

                    for(int j=m-2;j>=0;j--){
                          if(ch[i][j]==ch[i][j+1]){
                               ct++;
                               if(ch[i][j]=='1')
                                    c[i][j]=ct;
                          }
                          else{
                                 ct=0;
                                   if(ch[i][j]=='1'){
                                       c[i][j]=1;
                                        ct=1;
                                   }
                           }
                    }
               }
               int ans = Integer.MIN_VALUE;

                for(int j=0;j<m;j++){
                       int arr[] =  new int[n];
                       int ct[] = new int[m+1];
                       for(int i=0;i<n;i++)
                           ct[c[i][j]]++;

                       int in=0;
                      for(int i=0;i<ct.length;i++)
                             if(ct[i]>0){
                                while(ct[i]>0)
                                  { arr[in++]=i; ct[i]--;}
                             }
                        for(int i=0;i<arr.length;i++)
                                if(ans<(n-i)*arr[i])
                                    ans = (n-i)*arr[i];
                 }
                     out.println(ans);
                  out.flush();
    }
    static FastReader sc=new FastReader();

      static int ni(){
                 int x = sc.nextInt();
                 return(x);
        }
      static long nl(){
              long x = sc.nextLong();
              return(x);
         }
      static String n(){
                 String str = sc.next();
                     return(str);
       }
     static String ns(){
                 String str = sc.nextLine();
                   return(str);
      }
     static double nd(){
               double d = sc.nextDouble();
                 return(d);
       }
  static class FastReader
    {
        BufferedReader br;
        StringTokenizer st;

        public FastReader()
        {
            br = new BufferedReader(new
                     InputStreamReader(System.in));
        }

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

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

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

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

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


/* Editorial Approach

*/
import java.io.*;
import java.util.*;
public class gfg{

       public static void main(String[] args){
           PrintWriter out = new PrintWriter(System.out);
            int n = ni();
            int m = ni();
            char ch[][] = new char[n][m];
            int c[][] = new int[n][m];

                for(int i=0;i<n;i++)
                    ch[i] = sc.next().toCharArray();

                for(int i=0;i<n;i++){
                     int ct=0;
                     if(ch[i][m-1]=='1'){
                          c[i][m-1]=1;
                          ct=1;
                       }

                    for(int j=m-2;j>=0;j--){
                          if(ch[i][j]==ch[i][j+1]){
                               ct++;
                               if(ch[i][j]=='1')
                                    c[i][j]=ct;
                          }
                          else{
                                 ct=0;
                                   if(ch[i][j]=='1'){
                                       c[i][j]=1;
                                        ct=1;
                                   }
                           }
                    }
               }
               int ans = Integer.MIN_VALUE;

                for(int j=0;j<m;j++){
                       int arr[] =  new int[n];
                       int ct[] = new int[m+1];
                       for(int i=0;i<n;i++)
                           ct[c[i][j]]++;

                       int in=0;
                      for(int i=0;i<ct.length;i++)
                             if(ct[i]>0){
                                while(ct[i]>0)
                                  { arr[in++]=i; ct[i]--;}
                             }
                        for(int i=0;i<arr.length;i++)
                                if(ans<(n-i)*arr[i])
                                    ans = (n-i)*arr[i];
                 }
                     out.println(ans);
                  out.flush();
    }
    static FastReader sc=new FastReader();

      static int ni(){
                 int x = sc.nextInt();
                 return(x);
        }
      static long nl(){
              long x = sc.nextLong();
              return(x);
         }
      static String n(){
                 String str = sc.next();
                     return(str);
       }
     static String ns(){
                 String str = sc.nextLine();
                   return(str);
      }
     static double nd(){
               double d = sc.nextDouble();
                 return(d);
       }
  static class FastReader
    {
        BufferedReader br;
        StringTokenizer st;

        public FastReader()
        {
            br = new BufferedReader(new
                     InputStreamReader(System.in));
        }

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

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

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

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

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


/*
Keep solving problems.
*/
import java.util.*;
import java.io.*;

public class CF375B {

    BufferedReader br;
    PrintWriter out;
    StringTokenizer st;
    boolean eof;
    final long MOD = 1000L * 1000L * 1000L + 7;
    int[] csort;
    int[] hist;
    void solve() throws IOException {
        int n = nextInt();
        int m = nextInt();

        int[][] acc = new int[n][m];
        char[][] map = new char[n][m];

        csort = new int[m];
        hist = new int[1 + m];

        for(int i = 0; i < n; i++) {
            map[i] = nextString().toCharArray();
        }
        for(int i = 0; i < n; i++) {
            acc[i][0] = map[i][0] == '0' ? 0 : 1;
        }
        for(int j = 1; j < m; j++) {
            for(int i = 0; i < n; i++) {
                acc[i][j] = map[i][j] == '0' ? 0 : 1 + acc[i][j - 1];
            }
        }

        int[] arr = new int[n];
        int res = 0;
        for(int j = 0; j < m; j++) {
            for(int i = 0; i < n; i++) {
                arr[i] = acc[i][j];
            }
            countSort(arr);

            for(int i = 0; i < n; i++) {
                int tmp = arr[i] * (n - i);
                res = Math.max(res, tmp);
            }
        }
        out(res);
    }
    void countSort(int[] arr) {
        for(int i = 0; i < hist.length; i++) {
            hist[i] = 0;
        }
        for(int v : arr) {
            hist[v]++;
        }
        int idx = 0;
        for(int i = 0; i < hist.length; i++) {
            for(int j = 0; j < hist[i]; j++) {
                arr[idx + j] = i;
            }
            idx += hist[i];
        }
    }

    void shuffle(int[] a) {
        int n = a.length;
        for(int i = 0; i < n; i++) {
            int r = i + (int) (Math.random() * (n - i));
            int tmp = a[i];
            a[i] = a[r];
            a[r] = tmp;
        }
    }
    private void outln(Object o) {
        out.println(o);
    }
    private void out(Object o) {
        out.print(o);
    }
    public CF375B() throws IOException {
        br = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        long start = System.currentTimeMillis();
        solve();

        long end = System.currentTimeMillis();
//        System.out.println("take: " + (end - start) / 1000.0);
        out.close();
    }
    public static void main(String[] args) throws IOException {
        new CF375B();
    }

    public long[] nextLongArr(int n) throws IOException{
        long[] res = new long[n];
        for(int i = 0; i < n; i++)
            res[i] = nextLong();
        return res;
    }
    public int[] nextIntArr(int n) throws IOException {
        int[] res = new int[n];
        for(int i = 0; i < n; i++)
            res[i] = nextInt();
        return res;
    }
    public String nextToken() {
        while (st == null || !st.hasMoreTokens()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (Exception e) {
                eof = true;
                return null;
            }
        }
        return st.nextToken();
    }
    public String nextString() {
        try {
            return br.readLine();
        } catch (IOException e) {
            eof = true;
            return null;
        }
    }
    public int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }
    public long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }
    public double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }
}


/*
Keep solving problems.
*/
import java.util.*;
import java.io.*;

public class CF375B {

    BufferedReader br;
    PrintWriter out;
    StringTokenizer st;
    boolean eof;
    final long MOD = 1000L * 1000L * 1000L + 7;
    void solve() throws IOException {
        int n = nextInt();
        int m = nextInt();
        int[][] acc = new int[n][m];
        char[][] map = new char[n][m];
        for(int i = 0; i < n; i++) {
            map[i] = nextString().toCharArray();
        }
        for(int i = 0; i < n; i++) {
            acc[i][0] = map[i][0] == '0' ? 0 : 1;
        }
        for(int j = 1; j < m; j++) {
            for(int i = 0; i < n; i++) {
                acc[i][j] = map[i][j] == '0' ? 0 : 1 + acc[i][j - 1];
            }
        }

        int[] arr = new int[n];
        int res = 0;
        for(int j = 0; j < m; j++) {
            for(int i = 0; i < n; i++) {
                arr[i] = acc[i][j];
            }
            shuffle(arr);
            Arrays.sort(arr);

            for(int i = 0; i < n; i++) {
                int tmp = arr[i] * (n - i);
                res = Math.max(res, tmp);
            }
        }
        out(res);
    }

    void shuffle(int[] a) {
        int n = a.length;
        for(int i = 0; i < n; i++) {
            int r = i + (int) (Math.random() * (n - i));
            int tmp = a[i];
            a[i] = a[r];
            a[r] = tmp;
        }
    }
    private void outln(Object o) {
        out.println(o);
    }
    private void out(Object o) {
        out.print(o);
    }
    public CF375B() throws IOException {
        br = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        solve();
        out.close();
    }
    public static void main(String[] args) throws IOException {
        new CF375B();
    }

    public long[] nextLongArr(int n) throws IOException{
        long[] res = new long[n];
        for(int i = 0; i < n; i++)
            res[i] = nextLong();
        return res;
    }
    public int[] nextIntArr(int n) throws IOException {
        int[] res = new int[n];
        for(int i = 0; i < n; i++)
            res[i] = nextInt();
        return res;
    }
    public String nextToken() {
        while (st == null || !st.hasMoreTokens()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (Exception e) {
                eof = true;
                return null;
            }
        }
        return st.nextToken();
    }
    public String nextString() {
        try {
            return br.readLine();
        } catch (IOException e) {
            eof = true;
            return null;
        }
    }
    public int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }
    public long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }
    public double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }
}


/*
Keep solving problems.
*/
import java.util.*;
import java.io.*;

public class CF375B {

    BufferedReader br;
    PrintWriter out;
    StringTokenizer st;
    boolean eof;
    final long MOD = 1000L * 1000L * 1000L + 7;
    void solve() throws IOException {
        int n = nextInt();
        int m = nextInt();
        char[][] map = new char[n][m];
        for(int i = 0; i < n; i++) {
            char[] tmp = nextString().toCharArray();
            int cnt = 0;
            for(int j = 0; j < m; j++) {
                if(tmp[j] == '0') {
                    cnt++;
                }
            }
            for(int j = 0; j < cnt; j++) {
                map[i][j] = '0';
            }
            for(int j = cnt; j < m; j++) {
                map[i][j] = '1';
            }
        }
        int[] arr = new int[m];
        int res = 0;
        for(int i = 0; i < n; i++) {

            for(int j = 0; j < m; j++) {
                if(map[i][j] == '0') {
                    arr[j] = 0;
                }
                else {
                    arr[j]++;
                }
            }

            int tmp = getNum(arr);
            res = Math.max(res, tmp);
        }
        out(res);
    }

    public int getNum(int[] height) {
        if (height == null || height.length == 0) {
            return 0;
        }

        Stack<Integer> stack = new Stack<Integer>();

        int max = 0;
        int i = 0;

        while (i < height.length) {
            //push index to stack when the current height is larger than the previous one
            if (stack.isEmpty() || height[i] >= height[stack.peek()]) {
                stack.push(i);
                i++;
            } else {
                //calculate max value when the current height is less than the previous one
                int p = stack.pop();
                int h = height[p];
                int w = stack.isEmpty() ? i : i - stack.peek() - 1;
                max = Math.max(h * w, max);
            }

        }

        while (!stack.isEmpty()) {
            int p = stack.pop();
            int h = height[p];
            int w = stack.isEmpty() ? i : i - stack.peek() - 1;
            max = Math.max(h * w, max);
        }

        return max;
    }
    void shuffle(int[] a) {
        int n = a.length;
        for(int i = 0; i < n; i++) {
            int r = i + (int) (Math.random() * (n - i));
            int tmp = a[i];
            a[i] = a[r];
            a[r] = tmp;
        }
    }
    private void outln(Object o) {
        out.println(o);
    }
    private void out(Object o) {
        out.print(o);
    }
    public CF375B() throws IOException {
        br = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        solve();
        out.close();
    }
    public static void main(String[] args) throws IOException {
        new CF375B();
    }

    public long[] nextLongArr(int n) throws IOException{
        long[] res = new long[n];
        for(int i = 0; i < n; i++)
            res[i] = nextLong();
        return res;
    }
    public int[] nextIntArr(int n) throws IOException {
        int[] res = new int[n];
        for(int i = 0; i < n; i++)
            res[i] = nextInt();
        return res;
    }
    public String nextToken() {
        while (st == null || !st.hasMoreTokens()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (Exception e) {
                eof = true;
                return null;
            }
        }
        return st.nextToken();
    }
    public String nextString() {
        try {
            return br.readLine();
        } catch (IOException e) {
            eof = true;
            return null;
        }
    }
    public int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }
    public long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }
    public double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }
}


/*
Keep solving problems.
*/
import java.util.*;
import java.io.*;

public class CF375B {

    BufferedReader br;
    PrintWriter out;
    StringTokenizer st;
    boolean eof;
    final long MOD = 1000L * 1000L * 1000L + 7;
    void solve() throws IOException {
        int n = nextInt();
        int m = nextInt();
        int[][] acc = new int[n][m];
        char[][] map = new char[n][m];
        for(int i = 0; i < n; i++) {
            map[i] = nextString().toCharArray();
        }
        for(int i = 0; i < n; i++) {
            acc[i][0] = map[i][0] == '0' ? 0 : 1;
        }
        for(int j = 1; j < m; j++) {
            for(int i = 0; i < n; i++) {
                acc[i][j] = map[i][j] == '0' ? 0 : 1 + acc[i][j - 1];
            }
        }

        Integer[] arr = new Integer[n];
        int res = 0;
        for(int j = 0; j < m; j++) {
            for(int i = 0; i < n; i++) {
                arr[i] = acc[i][j];
            }
            Arrays.sort(arr);

            for(int i = 0; i < n; i++) {
                int tmp = arr[i] * (n - i);
                res = Math.max(res, tmp);
            }
        }
        out(res);
    }

    void shuffle(int[] a) {
        int n = a.length;
        for(int i = 0; i < n; i++) {
            int r = i + (int) (Math.random() * (n - i));
            int tmp = a[i];
            a[i] = a[r];
            a[r] = tmp;
        }
    }
    private void outln(Object o) {
        out.println(o);
    }
    private void out(Object o) {
        out.print(o);
    }
    public CF375B() throws IOException {
        br = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        solve();
        out.close();
    }
    public static void main(String[] args) throws IOException {
        new CF375B();
    }

    public long[] nextLongArr(int n) throws IOException{
        long[] res = new long[n];
        for(int i = 0; i < n; i++)
            res[i] = nextLong();
        return res;
    }
    public int[] nextIntArr(int n) throws IOException {
        int[] res = new int[n];
        for(int i = 0; i < n; i++)
            res[i] = nextInt();
        return res;
    }
    public String nextToken() {
        while (st == null || !st.hasMoreTokens()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (Exception e) {
                eof = true;
                return null;
            }
        }
        return st.nextToken();
    }
    public String nextString() {
        try {
            return br.readLine();
        } catch (IOException e) {
            eof = true;
            return null;
        }
    }
    public int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }
    public long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }
    public double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }
}


import java.io.*;
import java.util.*;
import java.awt.Point;

public class Main2 {
  static boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null;

  void runCase(int caseNum) throws IOException {
    int n = nextInt();
    int m = nextInt();

    int[][] counts = new int[m][n];
    for (int i = 0; i < n; ++i) {
      String s = next();
      int cnt = 0;
      for (int j = 0; j < s.length(); ++j) {
        if ('1' == s.charAt(j)) {
          ++cnt;
        } else {
          cnt = 0;
        }
        counts[j][i] = cnt;
      }
    }
    for(int i=0;i<counts.length;i++) {
    	for(int j=0;j<counts[i].length;j++) {
    		System.out.print(counts[i][j]+" ");
    	}
    	System.out.println();
    }
    System.out.println();
    int ret = 0;
    for (int i = 0; i < m; ++i) {
      Arrays.sort(counts[i]);
      for (int j = 0; j < n; ++j) {
//        System.out.print(counts[i][j] + " (n-j)="+(n-j)+" ");
        ret = Math.max(ret, counts[i][j] * (n - j));
      }
//      System.out.println("");
    }
    System.out.println(ret);
  }

  public static void main(String[] args) throws IOException {
    if (ONLINE_JUDGE) {
      in = new BufferedReader(new InputStreamReader(System.in));
      out = new PrintWriter(System.out);
    } else {
      in = new BufferedReader(new FileReader("input.txt"));
      out = new PrintWriter(System.out);
      //out = new PrintWriter("output.txt");
    }
    new Main2().runIt();
    out.flush();
    out.close();
    return;
  }

  static BufferedReader in;
  private StringTokenizer st;
  static PrintWriter out;

  static int pos;
  static String curInput = "";

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

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

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

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

  void runIt() throws IOException {
    st = new StringTokenizer("");

//        int N = nextInt();
//        for (int i = 0; i < N; i++) {
//            runCase(i + 1);
//        }
    runCase(0);
    out.flush();
  }

}


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

public class A {

	public static void main(String[] args) {
		FastReader in = new FastReader();
		int n = in.nextInt(), m = in.nextInt();
		char[][] board = new char[n][m];
		int[] rows = new int[m+1];
		for(int i=0;i<n;i++) {
			board[i] = in.next().toCharArray();
		}
		for(int i=0;i<n;i++) {
			for(int j=0;j<m;j++) {
				int index = j;
				while(index<m && board[i][index]=='1') index++;
				if(board[i][j]=='1') {
					rows[j]++;
					rows[index]--;
					j = index;
				}
			}
		}
		for(int i=1;i<=m;i++) rows[i]+=rows[i-1];
		int ans = 0;
		for(int i=0;i<n;i++) {
			int index = i;
			while(index<=m && rows[index]>=rows[i]) {
				index++;
			}
			ans = Math.max(ans,(index-i)*(rows[i]));
			i = index;
		}
//		System.out.println(Arrays.toString(rows));
		System.out.println(ans);
	}

	static final Random random=new Random();
	//	static void ruffleSort(Pair[] a) {
	//		int n=a.length;//shuffle, then sort
	//		for (int i=0; i<n; i++) {
	//			int oi=random.nextInt(n);
	//			Pair temp=a[oi];
	//			a[oi]=a[i]; a[i]=temp;
	//		}
	//		Arrays.sort(a);
	//	}
	static void ruffleSort(int[] a) {
		int n=a.length;//shuffle, then sort
		for (int i=0; i<n; i++) {
			int oi=random.nextInt(n), temp=a[oi];
			a[oi]=a[i]; a[i]=temp;
		}
		Arrays.sort(a);
	}
	static void ruffleSort(char[] a) {
		int n=a.length;//shuffle, then sort
		for (int i=0; i<n; i++) {
			int oi=random.nextInt(n);
			char temp=a[oi];
			a[oi]=a[i]; a[i]=temp;
		}
		Arrays.sort(a);
	}
	static class FastReader
	{
		BufferedReader br;
		StringTokenizer st;

		public FastReader()
		{
			br = new BufferedReader(new
					InputStreamReader(System.in));
		}

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

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

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

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

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

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

//class Pair implements Comparable<Pair>{
//    int a;
//    int b;
//    public Pair(int a, int b) {
//        this.a = a;
//        this.b = b;
//    }
//    public int compareTo(Pair o) {
//        if(this.a==o.a)
//            return this.b - o.b;
//        return this.a - o.a;
//    }
//}


import java.io.*;
import java.util.*;
import java.awt.Point;

public class Main2 {
  static boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null;

  void runCase(int caseNum) throws IOException {
    int n = nextInt();
    int m = nextInt();

    int[][] counts = new int[m][n];
    for (int i = 0; i < n; ++i) {
      String s = next();
      int cnt = 0;
      for (int j = 0; j < s.length(); ++j) {
        if ('1' == s.charAt(j)) {
          ++cnt;
        } else {
          cnt = 0;
        }
        counts[j][i] = cnt;
      }
    }
//    for(int i=0;i<counts.length;i++) {
//    	for(int j=0;j<counts[i].length;j++) {
//    		System.out.print(counts[i][j]+" ");
//    	}
//    	System.out.println();
//    }
    System.out.println();
    int ret = 0;
    for (int i = 0; i < m; ++i) {
      Arrays.sort(counts[i]);
      for (int j = 0; j < n; ++j) {
//        System.out.print(counts[i][j] + " (n-j)="+(n-j)+" ");
        ret = Math.max(ret, counts[i][j] * (n - j));
      }
//      System.out.println("");
    }
    System.out.println(ret);
  }

  public static void main(String[] args) throws IOException {
    if (ONLINE_JUDGE) {
      in = new BufferedReader(new InputStreamReader(System.in));
      out = new PrintWriter(System.out);
    } else {
      in = new BufferedReader(new FileReader("input.txt"));
      out = new PrintWriter(System.out);
      //out = new PrintWriter("output.txt");
    }
    new Main2().runIt();
    out.flush();
    out.close();
    return;
  }

  static BufferedReader in;
  private StringTokenizer st;
  static PrintWriter out;

  static int pos;
  static String curInput = "";

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

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

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

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

  void runIt() throws IOException {
    st = new StringTokenizer("");

//        int N = nextInt();
//        for (int i = 0; i < N; i++) {
//            runCase(i + 1);
//        }
    runCase(0);
    out.flush();
  }

}


import java.io.*;
import java.util.*;
import java.awt.Point;

public class Main2 {
  static boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null;

  void runCase(int caseNum) throws IOException {
    int n = nextInt();
    int m = nextInt();

    int[][] counts = new int[m][n];
    for (int i = 0; i < n; ++i) {
      String s = next();
      int cnt = 0;
      for (int j = 0; j < s.length(); ++j) {
        if ('1' == s.charAt(j)) {
          ++cnt;
        } else {
          cnt = 0;
        }
        counts[j][i] = cnt;
      }
    }
    for(int i=0;i<counts.length;i++) {
    	for(int j=0;j<counts[i].length;j++) {
    		System.out.print(counts[i][j]+" ");
    	}
    	System.out.println();
    }
    System.out.println();
    int ret = 0;
    for (int i = 0; i < m; ++i) {
      Arrays.sort(counts[i]);
      for (int j = 0; j < n; ++j) {
//        System.out.print(counts[i][j] + " (n-j)="+(n-j)+" ");
        ret = Math.max(ret, counts[i][j] * (n - j));
      }
//      System.out.println("");
    }
    System.out.println(ret);
  }

  public static void main(String[] args) throws IOException {
    if (!ONLINE_JUDGE) {
      in = new BufferedReader(new InputStreamReader(System.in));
      out = new PrintWriter(System.out);
    } else {
      in = new BufferedReader(new FileReader("input.txt"));
      out = new PrintWriter(System.out);
      //out = new PrintWriter("output.txt");
    }
    new Main2().runIt();
    out.flush();
    out.close();
    return;
  }

  static BufferedReader in;
  private StringTokenizer st;
  static PrintWriter out;

  static int pos;
  static String curInput = "";

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

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

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

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

  void runIt() throws IOException {
    st = new StringTokenizer("");

//        int N = nextInt();
//        for (int i = 0; i < N; i++) {
//            runCase(i + 1);
//        }
    runCase(0);
    out.flush();
  }

}


#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
typedef long long ll;
int main()
{
	ll n;
	cin >> n;
	vector<ll> vec(n);
	for(ll i=0;i<n;i++)
		cin >> vec[i];
	sort(vec.begin(),vec.end());
	ll res=0;
	for(ll i=0;i<vec.size();i++)
		res+=vec[i]*vec[vec.size()-1-i];
	res%=10007;
	cout << res << endl;
}


#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
typedef long long ll;
int main()
{
	ll n;
	cin >> n;
	vector<ll> vec(n);
	for(ll i=0;i<n;i++)
		cin >> vec[i];
	sort(vec.begin(),vec.end());
	ll res=0;
	for(ll i=0;i<vec.size();i++)
		res+=vec[i]*vec[vec.size()-1-i];
	cout << res << endl;
}


#define TASK "tree"
#define _CRT_SECURE_NO_WARNINGS

#pragma comment(linker, "/STACK:66777216")
#include <iostream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <ctime>
#include <map>
#include <set>
#include <string>
#include <queue>
#include <deque>
#include <cassert>
#include <cstdlib>
#include <bitset>
#include <algorithm>
#include <string>
#include <list>
#include <fstream>
#include <cstring>
#include <climits>
#include <stack>
#include <random>
#include <unordered_map>
#include <unordered_set>

using namespace std;

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef pair<string, int> psi;
typedef vector<string> vs;
typedef pair<ll, ll> pll;
typedef vector<ll> vll;
typedef vector<char> vc;
typedef vector<pii> vpii;
typedef vector<pair<ll, ll> > vpll;
typedef long double ld;

#define forn(i, n) for (int i = 0; i < (int)n; i++)
#define for1(i, n) for (int i = 1; i <= (int)n; i++)
#define forq(i, s, t) for (int i = s; i <= t; i++)
#define ford(i, s, t) for (int i = s; i >= t; i--)
#define mk make_pair
#define inb push_back
#define outb pop_back
#define all(v) v.begin(), v.end()
#define X first
//USE IF SUPER HARD GEOM
//#define double long double
#define Y second
#define TIME clock() * 1.0 / CLOCKS_PER_SEC
#define sqr(x) (x) * (x)
#define y1 amdknkgsdaasdwapgnpikn
//
#define mp make_pair
#define pb push_back
#define XX first
#define YY second
//

const ld EPS = 1e-7;
const ld pi = acos(-1.0);

const int MAXN = (int)1e5 + 7;
const int INF = (ll)(1 << 31) - 1;
const ll LINF = (ll)1e18;
const ll MOD = (ll)1e9 + 7;
const int CHASH = (ll)239017;
const ld DINF = (ld)1000000000000000.0;

void gen();
int solve();

int main()
{
	/*iostream::sync_with_stdio(0);
	cin.tie(0);*/
#ifdef _DEBUG
	gen();
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	freopen("test.txt", "w", stderr);
	ld tstart = TIME;
#else
	//freopen(TASK".in", "r", stdin), freopen(TASK".out", "w", stdout);
	//freopen("input.txt", "r", stdin), freopen("output.txt", "w", stdout), freopen("test.txt", "w", stderr);
	srand(228);
#endif
	solve();
#ifdef _DEBUG
	ld tend = TIME;
	cerr << tend - tstart << " s.\n";
#endif
	return 0;
}

void gen()
{
	freopen("input.txt", "a+", stdout);
	srand(time(0));
	return;
}

bool equal(double a, double b)
{
	return abs(a - b) < EPS;
}

struct Point
{// vector
	double x, y;
	int id;
	Point() {};
	Point(double x, double y) : x(x), y(y) {};
	//point mul by double
	Point operator*(double d) { return Point(x * d, y * d); }
	//point + vector
	Point operator+(Point p) { return Point(x + p.x, y + p.y); }
	Point operator-(Point p) { return Point(x - p.x, y - p.y); }
	//dotProduct
	double operator%(Point p) { return x * p.x + y * p.y; }
	//crossProduct
	double operator*(Point p) { return x * p.y - y * p.x; }
	// rasstoyanie
	bool operator== (Point p) { return equal(x, p.x) && equal(y, p.y); }
	// equal
	double distancetoPoint(Point p)
	{
		return sqrt((x - p.x) * (x - p.x) + (y - p.y) * (y - p.y));
	}
	// vector length \ distance from zero to Point
	double len() { return sqrt(x * x + y * y); }
	double angle(Point p) { return atan2((*this) * p, (*this) % p); }
	// turnByAngle
	Point turnByAngle(double a) {
		double cosa = cos(a); double sina = sin(a);
		return Point(x * cosa - y * sina, x * sina + y * cosa);
	}
};

Point makeV(Point a, Point b) { return a - b; }
const Point NULLP = Point(-239239, 1488228);
const Point EQ = Point(13888, 888283);

struct Line
{
	double a, b, c;
	Point q, w;
	Line() {};
	Line(double a, double b, double c) : a(a), b(b), c(c) {};
	Line(Point p, Point t) {
		a = t.y - p.y; // -n.y
		b = p.x - t.x; // n.x
		c = -a * p.x - b * p.y;
		q = p;
		w = t;
	}

	// oriented!!!
	double distanceFromPoint(Point p) {
		return (a * p.x + b * p.y + c) / Point(a, b).len();
	}

	bool operator||(Line l) {
		return equal(Point(a, b) * Point(l.a, l.b), 0);
	}

	bool ifeq(Line l)
	{
		Point v1 = makeV(q, w);
		Point v2 = makeV(l.q, l.w);
		Point v11 = makeV(l.w, w);
		Point v22 = makeV(q, l.q);
		if (v1 * v2 == 0 && v11 * v22 == 0)
			return 1;
		return 0;
	}

	Point operator^(Line l)
	{
		if ((*this).ifeq(l))
			return EQ;
		double d = Point(a, b) * Point(l.a, l.b);
		if (equal(d, 0))
			return NULLP;
		double x = (b * l.c - l.b * c) / d;
		double y = (c * l.a - l.c * a) / d;
		return Point(x, y);
	}
};

istream& operator>>(istream &input_stream, Point &a) {
	input_stream >> a.x >> a.y;
	return input_stream;
}

ostream& operator<<(ostream &output_stream, Point &a) {
	output_stream.precision(15);
	output_stream << fixed << a.x << " " << a.y;
	return output_stream;
}

int n;
ll l[MAXN], sl[MAXN];

int solve()
{
	cin >> n;
	forn(i, n)
	{
		cin >> l[i];
		sl[i] = l[i];
	}
	sort(l, l + n);
	sort(sl, sl + n);
	reverse(sl, sl + n);
	ll ans = 0;
	forn(i, n)
		ans = (ans + l[i] * sl[i]) % 10007;
	cout << ans;
	return 0;
}


#include<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>
using namespace std;
vector<long long>v;
vector<long long>v1;
#define MOD 10007
int main()
{
	long long n,p;
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		scanf("%lld",&p);
		v.push_back(p);
		v1.push_back(p);

	}
	sort(v.begin(),v.end());
	sort(v1.rbegin(),v1.rend());
	long long sum=0;
	for(int i=0;i<v.size();i++)
	{
		sum=(sum%MOD)+((v[i]%10007)*(v1[i]%10007))%10007;
		sum=sum%MOD;
	}
	cout<<sum<<"\n";

}


#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>
#include <math.h>
#include <queue>
#include <string>
#include <string.h>
#include <map>
#include <vector>
#include <fstream>
using namespace std;
#define N 105105
//#define MAXN 1125899906842624L
#define MAXN 100
#define MAXVAL 2000000000000L
#define MOD 1000000007
int n, m, K;
int a[N];
long long getMin(long long x, long long y) {
	return x < y ? x : y;
}
void solve() {
	int i, j, k, m, x, y;
	for (i = 0; i < n; i++) {
		scanf("%d", &a[i]);
	}
	sort(a, a+n);
	int ans = 0;
	for (i = 0; i < n; i++) {
		ans = (ans + a[i] * a[n-i-1]) % 10007;
	}
	printf("%d\n", ans);
}
int main() {
	while (scanf("%d", &n) != EOF) {
		solve();
	}
	return 0;
}


#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>
#include <math.h>
#include <queue>
#include <string>
#include <string.h>
#include <map>
#include <vector>
#include <fstream>
using namespace std;
#define N 105105
//#define MAXN 1125899906842624L
#define MAXN 100
#define MAXVAL 2000000000000L
#define MOD 1000000007
int n, m, K;
long long a[N];
long long getMin(long long x, long long y) {
	return x < y ? x : y;
}
void solve() {
	int i;
	for (i = 0; i < n; i++) {
		scanf("%d", &a[i]);
	}
	sort(a, a+n);
	long long ans = 0;
	for (i = 0; i < n; i++) {
		ans = (ans + a[i] * a[n-i-1]) % 10007;
	}
	printf("%lld\n", ans);
}
int main() {
	while (scanf("%d", &n) != EOF) {
		solve();
	}
	return 0;
}


#include <iostream>
#include <stdio.h>
#include <locale>
#include <windows.h>
#include <math.h>
#include <algorithm>
using namespace std;
typedef long long ll;
int main()
{
    ll n,i,j,rez=0,a[100000];
    cin>>n;
    for (i=0; i<n; i++)
        cin>>a[i];
    sort(a,a+n);
    for (i=0; i<n; i++)
        rez=(rez+a[i]*a[n-i-1])%10007;
    cout<<rez;
    return 0;
}


#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>

using namespace std;
int main()
{
	long long n;
	cin>>n;
	vector<long long> a(n);
	for (long long i=0;i<n;i++)
		cin>>a[i];
	sort(a.begin(),a.end());
	long long res=0;
	for (long long i=0;i<n;i++)
	{
		res+=a[i]*a[n-i-1]%10007;
		res=res%10007;
	}
	cout<<res%10007;
	return 0;
}


#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>

using namespace std;
int main()
{
	int n;
	cin>>n;
	vector<int> a(n);
	for (int i=0;i<n;i++)
		cin>>a[i];
	sort(a.begin(),a.end());
	int res=0;
	for (int i=0;i<n;i++)
	{
		res+=a[i]*a[n-i-1]%10007;
		res=res%10007;
	}
	cout<<res%10007;
	return 0;
}


#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>

using namespace std;
int main()
{
	int n;
	cin>>n;
	vector<int> a(n);
	for (int i=0;i<n;i++)
		cin>>a[i];
	sort(a.begin(),a.end());
	int res=0;
	for (int i=0;i<n;i++)
	{
		res+=a[i]*a[n-i-1]%10007;
	}
	cout<<res%10007;
	return 0;
}


#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>

using namespace std;
int main()
{
	int n;
	cin>>n;
	vector<int> a(n);
	for (int i=0;i<n;i++)
		cin>>a[i];
	sort(a.begin(),a.end());
	int res=0;
	for (int i=0;i<n;i++)
	{
		res+=a[i]*a[n-i-1];
	}
	cout<<res;
	return 0;
}


//http://codeforces.com/contest/717/problem/C

#include <iostream>
#include <string>
#include <cmath>
#include <vector>
#include <algorithm>
#include <iterator>
#include <cstdlib>
#include <cstdio>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <list>

using namespace std;

#define pii pair <int, int>
#define pll pair <long long, long long>
#define vi vector <int>
#define ll long long
#define mp make_pair
#define fir first
#define sec second

const int mod = 10007;

int n;
ll result = 0;
vector <ll> difficulty(0), sorted(0);

int main()
{
	int ii;

	ios::sync_with_stdio(false);

	cin >> n;

	difficulty.resize(n);
	sorted.resize(n);

	for (ii = 0; ii < n; ii++)
		cin >> difficulty[ii];

	sorted = difficulty;
	sort(sorted.begin(), sorted.end());

	for (ii = 0; ii < n; ii++)
	{
		result += difficulty[ii] * sorted[n - ii - 1];

		result %= mod;
	}

	cout << result << endl;

	return 0;
}


//http://codeforces.com/contest/717/problem/C

#include <iostream>
#include <string>
#include <cmath>
#include <vector>
#include <algorithm>
#include <iterator>
#include <cstdlib>
#include <cstdio>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <list>

using namespace std;

#define pii pair <int, int>
#define pll pair <long long, long long>
#define vi vector <int>
#define ll long long
#define mp make_pair
#define fir first
#define sec second

const int mod = 10007;

int n;
ll result = 0;
vector <ll> difficulty(0);

int main()
{
	int ii;

	ios::sync_with_stdio(false);

	cin >> n;

	difficulty.resize(n);

	for (ii = 0; ii < n; ii++)
		cin >> difficulty[ii];

	sort(difficulty.begin(), difficulty.end());

	for (ii = 0; ii < n; ii++)
		result += difficulty[ii] * difficulty[n - ii - 1];

	result %= mod;

	cout << result << endl;

	return 0;
}


//http://codeforces.com/contest/717/problem/C

#include <iostream>
#include <string>
#include <cmath>
#include <vector>
#include <algorithm>
#include <iterator>
#include <cstdlib>
#include <cstdio>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <list>

using namespace std;

#define pii pair <int, int>
#define pll pair <long long, long long>
#define vi vector <int>
#define ll long long
#define mp make_pair
#define fir first
#define sec second

const int mod = 10007;

int n;
ll result = 0;
vector <int> difficulty(0), sorted(0);

int main()
{
	int ii;

	ios::sync_with_stdio(false);

	cin >> n;

	difficulty.resize(n);
	sorted.resize(n);

	for (ii = 0; ii < n; ii++)
		cin >> difficulty[ii];

	sorted = difficulty;
	sort(sorted.begin(), sorted.end());

	for (ii = 0; ii < n; ii++)
	{
		result += difficulty[ii] * sorted[n - ii - 1];

		result %= mod;
	}

	cout << result << endl;

	return 0;
}


#include <stdio.h>
#include <vector>
#include <set>
#include <queue>
#include <limits.h>
#include <algorithm>
#include <math.h>
#include <string.h>

#define MOD 10007

using namespace std;

typedef pair<int, int> pii;
typedef set<int> si;
typedef set<pii> spii;
typedef si::iterator sit;
typedef spii::iterator spiit;
typedef vector<int> vi;
typedef vector<pii> vpii;
typedef vi::iterator vit;
typedef vpii::iterator vpiit;
typedef long long lol;
typedef vector<lol> vlol;
typedef vlol::iterator vlolt;

int main()
{
	int n;
	scanf("%d", &n);

	multiset<int> vals;

	int a;
	for (int i = 0; i < n; i++)
	{
		scanf("%d", &a);
		vals.insert(a);
	}

	multiset<int>::iterator it = vals.begin();
	multiset<int>::reverse_iterator rt = vals.rbegin();
	lol out = 0;
	while (it != vals.end())
	{
		out += ((lol)*it) * ((lol)*rt);
		out = out % MOD;
		++it;
		++rt;
	}
	printf("%I64d", out);
	//scanf("%d", &n);
}


#include <iostream>
#include <cstring>
#include <string>
#include <vector>
#include <math.h>
#include <algorithm>
#include <set>
#include <stack>
#include <queue>
#include <map>
using namespace std;

int mymin(int x, int y){
	if (x < y)
		return x;
	return y;
}

int mymax(int x, int y){
	if (x < y)
		return y;
	return x;
}

const int bval = 1e5 + 7;
int a[bval];
int pr = 10007;
vector<int> vec;
int main()
{
	int n;
	cin >> n;
	int x;
	for (int i = 0; i < n; i++){
		cin >> x;
		vec.push_back(x);
		//cin >> a[i];
	}

	sort(vec.begin(), vec.end());

	long long total = 0;
	for (int i = 0; i < n; i++){
		total += (vec[i] % pr) * (vec[n - 1 - i] % pr);
		total = total % pr;
	}

	cout << total << endl;
	//system("pause");
    return 0;
}


#include <iostream>
#include <cstring>
#include <string>
#include <vector>
#include <math.h>
#include <algorithm>
#include <set>
#include <stack>
#include <queue>
#include <map>
using namespace std;

int mymin(int x, int y){
	if (x < y)
		return x;
	return y;
}

int mymax(int x, int y){
	if (x < y)
		return y;
	return x;
}

const int bval = 1e5 + 7;
int a[bval];
int pr = 10007;

int main()
{
	int n;
	cin >> n;
	for (int i = 0; i < n; i++){
		cin >> a[i];
	}

	sort(a, a + n);

	long long total = 0;
	for (int i = 0; i < n; i++){
		total += a[i] * a[n - 1 - i];
		total = total % pr;
	}

	cout << total << endl;
	//system("pause");
    return 0;
}


#include <iostream>
#include <cstring>
#include <string>
#include <vector>
#include <math.h>
#include <algorithm>
#include <set>
#include <stack>
#include <queue>
#include <map>
using namespace std;

int mymin(int x, int y){
	if (x < y)
		return x;
	return y;
}

int mymax(int x, int y){
	if (x < y)
		return y;
	return x;
}

const int bval = 1e5 + 7;
int a[bval];
int pr = 10007;
vector<int> vec;
int main()
{
	int n;
	cin >> n;
	int x;
	for (int i = 0; i < n; i++){
		cin >> x;
		vec.push_back(x);
		//cin >> a[i];
	}

	sort(vec.begin(), vec.end());

	long long total = 0;
	for (int i = 0; i < n; i++){
		total += vec[i] * vec[n - 1 - i];
		total = total % pr;
	}

	cout << total << endl;
	//system("pause");
    return 0;
}


'''
a=input()
string=input()
n=int(input())
list1=[]
score=0

for i in range(n):
    list1.append((input()).split())

maX=int(input())

list2=[0]*len(string)
var = 0
while n>0:
    times = 0
    for i in range (len(string)):
        if string[i:i+len(list1[var][0])] == list1[var][0] and not maX in list2[i:i+len(list1[var][0])]:
            score += int(list1[var][1])
            for j in range(i, i+len(list1[var][0])):
                list2[j] += 1
            if i+len(list1[var][0]) == len(string):
                break
            if times == maX:
                break
    var += 1
    n -= 1

print(score)
'''

final=0
n= int(input())
list1=[]

for i in range(n):
    list1.append(int(input()))
list1.sort()
for i in range(n):
    final += list1[i] * list1[n-i-1]
print(final)


'''
a=input()
string=input()
n=int(input())
list1=[]
score=0

for i in range(n):
    list1.append((input()).split())

maX=int(input())

list2=[0]*len(string)
var = 0
while n>0:
    times = 0
    for i in range (len(string)):
        if string[i:i+len(list1[var][0])] == list1[var][0] and not maX in list2[i:i+len(list1[var][0])]:
            score += int(list1[var][1])
            for j in range(i, i+len(list1[var][0])):
                list2[j] += 1
            if i+len(list1[var][0]) == len(string):
                break
            if times == maX:
                break
    var += 1
    n -= 1

print(score)
'''
'''
final=0
n= int(input())
list1=[]

for i in range(n):
    list1.append(int(input()))
list1.sort()
for i in range(n):
    final += list1[i] * list1[n-i-1]
print(final%10007)
'''
def single_Element(list1):
    if list1[len(list1)-1] != list1[len(list1)-2]:
        return list1[len(list1)-1]
    for i in range(0, len(list1), 2):
        if list1[i] != list1[i+1]:
            return list1[i]
    return False

n=input()
list1 = (input().split())
list1.sort()
single = int(single_Element(list1))
list1.remove(str(single))
if abs(int(list1[0]) - single) == abs(int(list1[len(list1)-1])-single) and not single_Element(list1):
    print("YES")
else:
    print("NO")


'''
a=input()
string=input()
n=int(input())
list1=[]
score=0

for i in range(n):
    list1.append((input()).split())

maX=int(input())

list2=[0]*len(string)
var = 0
while n>0:
    times = 0
    for i in range (len(string)):
        if string[i:i+len(list1[var][0])] == list1[var][0] and not maX in list2[i:i+len(list1[var][0])]:
            score += int(list1[var][1])
            for j in range(i, i+len(list1[var][0])):
                list2[j] += 1
            if i+len(list1[var][0]) == len(string):
                break
            if times == maX:
                break
    var += 1
    n -= 1

print(score)
'''

final=0
n= int(input())
list1=[]

for i in range(n):
    list1.append(int(input()))
list1.sort()
for i in range(n):
    final += list1[i] * list1[n-i-1]
print(final%10007)


def main():
    n = int(input())
    total = 0
    list1 = []
    for i in range(n):
        a = int(input())
        list1.append(a)
    list1 = sorted(list1)
    for i in range(n):
        total = total + list1[i]*list1[n-i-1]
    print(total%10007)

main()


def main():
    n = int(input())
    total = 0
    list1 = []
    for i in range(n):
        a = int(input())
        list1.append(a)
    list1 = sorted(list1)
    for i in range(n):
        total = total + list1[i]*list1[n-i-1]
    print(total)

main()


def main():
    n = int(input())
    total = 0
    list1 = []
    for i in range(n):
        a = int(input())
        list1.append(a)
    list1 = sorted(list1)
    if min(list1) != max(list1):
        for i in range(n):
            total = total + list1[i]*list1[n-i-1]
    print(total)

main()


n=int(input())
a = []
for _ in range(n):
    a.append(int(input()))

a = sorted(a)
b = sorted(a, reverse=True)
print (sum([i*j for i,j in zip(a,b)]) % 10007)


n=int(input())
a = []
for _ in range(n):
    a.append(int(input()))

a = sorted(a)
b = sorted(a, reverse=True)
print (sum([i*j for i,j in zip(a,b)]))


n=int(input())
l=[]
d=[]
count=0
for i in range(n):
    p=int(input())
    l.append(p)
    d.append(p)
d.sort()
l.sort()
d=d[::-1]
for i in range(n):

    count+=(d[i])*(l[i])
print(count%10007)


n=int(input())
l=[]
d=[]
count=0
for i in range(n):
    p=int(input())
    l.append(p)
    d.append(p)
d=d[::-1]
for i in range(n):
    count+=d[i]*l[i]
print(count)


n=int(input())
l=[]
d=[]
count=0
for i in range(n):
    p=int(input())
    l.append(p)
    d.append(p)
d.sort()
l.sort()
d=d[::-1]
for i in range(n):

    count+=(d[i]%10007)*(l[i]%10007)
print(count)


n=int(input())
l=[]
d=[]
count=0
for i in range(n):
    p=int(input())
    l.append(p)
    d.append(p)
d.sort()
l.sort()
d=d[::-1]
for i in range(n):
    count+=d[i]*l[i]
print(count)


A=[]
for _ in range(int(input())):
   A.append(int(input()))
A=sorted(A)
B=list(reversed(A))
s=0
for _ in range(len(A)):
   s+=A[_]*B[_]
print(s%10007)


n = int(input())

a = []

for i in range(n):
    a.append(int(input()))

a.sort()

b = [];

for i in range(int((n+1)/2)):
    b.append(a[i]*a[n-1-i])

res = sum(b)*2

if n%2 == 1:
    res-=b[len(b)-1]

print(res % 10007)


n = int(input())

a = []

for i in range(n):
    a.append(int(input()))

a.sort()

b = [];

for i in range(int((n+1)/2)):
    b.append(a[i]*a[n-1-i])

res = sum(b)*2

if n%2 == 1:
    res-=b[len(b)-1]

print(res)


n = int(input())
dt = [int(input()) for i in range(n)]

ans = 0
for i in range(n):
	ans += dt[i] * dt[-i-1]
print(ans)


n = int(input())
dt = sorted([int(input()) for i in range(n)])

ans = 0
for i in range(n):
	ans += dt[i] * dt[-i-1]
print(ans%10007)


n = int(input())
dt = sorted([int(input()) for i in range(n)])

ans = 0
for i in range(n):
	ans += dt[i] * dt[-i-1]
print(ans)


#import sys
#sys.stdin=open('input.txt')
#a=map(int,input().split())
n=int(input())
l=[]
for i in range(n):
	l.append(int(input()))
d=l[::]
l.sort()
d.sort(reverse=True)
print(sum((l[x]*d[x] for x in range(n)))%10007)
#print('right:',input())


#import sys
#sys.stdin=open('input.txt')
#a=map(int,input().split())
n=int(input())
l=[]
for i in range(n):
	l.append(int(input()))
d=l[::]
l.sort()
d.sort(reverse=True)
print(sum((l[x]*d[x] for x in range(n)))%10007)
print('right:',input())


n = int(input())
arr = sorted([int(input()) for i in range(n)])
s = 0
for i in range(n):
    s += arr[i] * arr[n - 1 - i]
print(s % 10007)


n = int(input())
a=[]
for i in range(n):
    a += [int(input())]
a.sort()
ans = 0
for i in range(n):
    ans += a[i] * a[n-i-1]
print(ans % 10007)


n = int(input())
a=[]
for i in range(n):
    a += [int(input())]
ans = 0
for i in range(n):
    ans += a[i] * a[n-i-1]
print(ans)


n = int(input())
a=[]
for i in range(n):
    a += [int(input())]
ans = 0
for i in range(n):
    ans += a[i] * a[n-i-1]
print(ans % 10007)


n=int(input())
a=sorted(int(input()) for _ in range(n))
print(sum(a[i]*a[-i-1] for i in range(n))%10007)


n = int(input())
ai = []
num = 0
for i in range(n):
    ai += [int(input())]
ai.sort()
for i in range(n//2):
    num += ai[n-i-1] * ai[i] * 2
if n % 2:
    num += ai[n//2] ** 2
print(num % 10007)


n = int(input())
ai = []
num = 0
for i in range(n):
    ai += [int(input())]
for i in range(n//2):
    num += ai[n-i-1] * ai[i] * 2
if n % 2:
    num += ai[n//2+1] ** 2
print(num % 10007)


laziness = []
for i in range(int(input())):
    laziness.append(int(input()))

laziness.sort()
j = len(laziness) - 1
sum = 0
for numb in laziness:
    sum += numb * laziness[j]
    j -= 1

print(sum % 10007)


n=int(input())
ans=0
l=[]
for i in range(n):
    x=int(input())
    l.append(x)
l.sort()
l1=l[::-1]
for i in range(n):
    ans+=l[i]*l1[i]
print(ans%10007)


n = int(input())
a = [int(input()) for x in range(n)]
a.sort()
s = 0
for i in range(n):
    s += a[i] * a[n-i-1]
    s %= 10007
print(s)


#!/usr/bin/env	python
#-*-coding:utf-8 -*-
n=int(input())
A=sorted(int(input())for _ in range(n))
B=10007
s=0
for i in range(n):s=(A[i]*A[-1-i]+s)%B
print(s)


n = int(input())
A = [0] * n
for i in range(n):
    per = int(input())
    A[i] = per
A.sort()
answer = 0
for i in range(n):
    answer  = (answer + A[i] * A[n - i - 1]) % 10007
print(answer)


# ipnut
n = int(input())
a = [int(input()) for i in range(n)]
divider = 10007
a.sort()
res = 0
for i in range(n):
    res += a[i] * a[n - 1 - i]
    res %= divider
print(res)
# sort
# swap and count


I=input
n=int(I())
R=list(range(n))
a=sorted(int(I())for _ in R)
k=0
for i in R:k=(k+a[i]*a[n-i-1])%10007
print(k)


n = int(input())
l = sorted(int(input()) for _ in range(n))

s = 0

for i in range(n):
    s += l[i] * l[n-i-1]

print(s)


n = int(input())
a = sorted(int(input()) for _ in range(n))
print(sum(a[i] * a[n-i-1] for i in range(n)))


n = int(input())
a = sorted([int(input()) for _ in range(n)])
print(sum([a[i] * a[n-i-1] for i in range(n)]) % 10007)


n = int(input())
lazy = []
tasks = []
for x in range(n):
	k = int(input())
	lazy.append(k)
	tasks.append(k)
lazy.sort()
tasks.sort(reverse = True)
thing = list(zip(lazy, tasks))
total = 0
for x in thing:
	total += x[0] * x[1]

print(int(total%10007))


N = int(input())
A = []
for i in range(N):
    A.append(int(input()))

A.sort()

ans = 0;
for i in range(len(A)):
    ans += A[i] * A[len(A) - 1 - i]

print(ans % 10007)


num= int(input())
work=[]
for i in range(num):
    work.append(int(input()))
laziness= work.copy()
time= 0

laziness.sort()
work.sort()
work=work[::-1]

for i in range(len(work)):
    time += work[i] * laziness[i]

print (time % (10007))


num= int(input())
work=[]
for i in range(num):
    work.append(int(input()))
laziness= work.copy()
time= 0

laziness.sort()
work.sort()
work=work[::-1]

for i in range(len(work)):
    time += work[i] * laziness[i]

print (time)


n = int(input())
a = []
for _ in range(n):
    a.append(int(input()))
a = sorted(a)
res = 0
for i in range(n):
    res = (res + a[i] * a[n - i - 1]) % 10007
print(res)


n = int(input())
s = sorted([int(input()) for i in range(n)])
#print(s)
a = 0
q = 10007
for i in range(n//2):
    a += ((s[i]*s[n-1-i]*2)%q)
if n%2==1:
    a += ((s[n//2]**2)%q)
print(a%q)


n=int(input())
list=[]
summ=int(0)
for i in range(n):
    a=int(input())
    list.append(a)
rev=list[::]
list.sort()
rev.sort(reverse=True)
for x in range(n):
    summ=summ+((list[x]*rev[x])%10007)
print(summ)


n=int(input())
list=[]
summ=int(0)
for i in range(n):
    a=int(input())
    list.append(a)
rev=list[::]
list.sort()
rev.sort(reverse=True)
for x in range(n):
    summ=(summ+((list[x]*rev[x])%10007)%10007)%10007
print(summ)


from operator import mul

A = sorted(int(input()) for _ in range(int(input())))

print(sum(map(mul, A, reversed(A))))


from operator import mul

A = sorted(int(input()) for _ in range(int(input())))

print(sum(map(mul, A, reversed(A))) % 10007)


n = int(input())
sp = []
for i in range(n):
    sp.append(int(input()))
sp.sort()
s = 0
for i in range(n):
    s = (s + sp[i] * sp[-i-1]) % 10007
print(s)


n = int(input())
sp = []
for i in range(n):
    sp.append(int(input()))

sp.sort()
sp1 = sp[::-1]
s = 0
for i in range(n):
    s = s + sp[i] * sp1[i]

print(s)


n = int(input())
sp = []
for i in range(n):
    sp.append(int(input()))
sp.sort()
s = 0
for i in range(n):
    s = s + sp[i] * sp[-i-1]
print(s)


n = int(input())
num = sorted([int(input()) for _ in range(n)])
print(sum([x*y for x,y in zip(num, reversed(num))])%10007)


n = int(input())

num = [int(input()) for _ in range(n)]
num.sort()

begin = 0
end = n-1
ans = 0

while begin<=end:
    if begin == end:
        ans += (num[begin]*num[end])
        ans %= 10007
    else:
        ans += 2*num[begin]*num[end]
        ans %= 10007
    begin+=1
    end-=1

print(ans)


n = int(input())
a = [int(input()) for i in range(n)]
mod = 10007

a.sort()
ans = 0
for i in range(n):
    ans += a[i] * a[n - 1 - i] % mod
    if ans >= mod:
        ans -= mod

print(ans)


n=int(input())

a=sorted(int(input()) for _ in range(n))

print(sum(a[i]*a[-i-1] for i in range(n))%10007)

# Made By Mostafa_Khaled


n=int(input())
a=sorted(int(input()) for _ in range(n))
print(sum(a[i]*a[-i-1] for i in range(n))%10007)


n = int(input())
a = []

for _ in range(n):
    a.append(int(input()))

a.sort()

ans = 0

for x, y in zip(a, reversed(a)):
    ans = (ans + x*y) % 10007

print(ans)


n = int(input())
a =[]
b =[]
for i in range(n):
	a.append(int(input()))
	b.append(a[len(a)-1])
a.sort()
b.sort()
b.reverse()
sum = 0
for i in range(n):
	sum+=(a[i]*b[i])%10007
print(sum)


n = int(input())
a =[]
b =[]
for i in range(n):
	a.append(int(input()))
	b.append(a[len(a)-1])
a.sort()
b.sort()
b.reverse()
sum = 0
for i in range(n):
	sum+=(a[i]*b[i])
	sum%=10007
print(sum)


n=int(input())
array=[]
for i in range(0,n):
    x=int(input())
    array.append(x)
array.sort()
sum=0
for i in range(0,n):
    sum=sum+array[i]*array[n-1-i]
print(sum)


n=int(input())
array=[]
for i in range(0,n):
    x=int(input())
    array.append(x)
array.sort()
sum=0
for i in range(0,n):
    sum=sum+array[i]*array[n-1-i]
print(sum%10007)


n = int(input())
a = sorted([int(input()) for i in range(n)])

time = 0
for i in range(n):
    time += a[i] * a[n - 1 - i]

print(time % 10007)


n = int(input())
a = [int(input()) for i in range(n)]
a.sort()
print(sum(map(lambda x,y: x*y, a, reversed(a))) % 10007)


n=int(input())
lst=[]
app=lst.append
from sys import stdin
for i in range(n):
    x=int(stdin.readline())
    app(x)
lst.sort()
res=0
for i,x in enumerate(lst):
    res+=lst[-i-1]*x
    res=res%10007
print(res)


from operator import mul
from sys import stdin

input()
l = sorted(map(int, stdin.read().splitlines()))
print(sum(map(mul, l, reversed(l))) % 10007)


from sys import stdin

input()
l = sorted(map(int, stdin.read().splitlines()))
print(sum(a * b for a, b in zip(l, reversed(l))) % 10007)


n= int(input())
l=[]
for _ in range(n):
    a= int(input())
    l.append(a)
l1= list(sorted(l))
l2= list(reversed(list(sorted(l))))
s=0
for i in range(n):
    s+= l1[i]*l2[i]
print(s)


n= int(input())
l=[]
for _ in range(n):
    a= int(input())
    l.append(a)
l1= list(sorted(l))
l2= list(reversed(list(sorted(l))))
s=0
for i in range(n):
    s+= l1[i]*l2[i]
print(s%10007)


n=int(input())
l=[]
for i in range(n):
   l.append(int(input()))
l1=l[::-1]
ans=0
for i in range(n):
   ans+=l[i]*l1[i]
print(ans%10007)


n=int(input())
l=[]
for i in range(n):
   l.append(int(input()))
l.sort()
l1=l[::-1]
ans=0
for i in range(n):
   ans+=l[i]*l1[i]
print(ans%10007)


n=int(input())
l=[]
for i in range(n):
    l.append(int(input()))
l.sort()
r=l[:];
r.reverse()
res=0;
for i in range(n):
    res=(res+l[i]*r[i])%10007
print(res)


n = int(input())
A = [int(input()) for i in range(n)]
A.sort()
B = A
B.reverse()
C = []
for x in range(n):
    C.append(A[x]*B[n-x-1])
    print(C)
print(C)
print(sum(C))


n = int(input())
C = []
A = [int(input()) for i in range(n)]
A.sort()
B = A
for x in range(n):
    C.append(A[x]*B[n-x-1])
a = sum(C)
print(a%10007)


n = int(input())
C = []
A = [int(input()) for i in range(n)]
A.sort()
B = A
for x in range(n):
    C.append(A[x]*B[n-x-1])
print(sum(C))


a=int(input())
l=[]
b=[]
prod=[]
for i in range(a):
  l.append(int(input()))
b=b+l
l.reverse()
for num1, num2 in zip(l, b):
	prod.append(num1 * num2)
print(sum(prod)%10007)


a=int(input())
l=[]
b=[]
prod=[]
for i in range(a):
  l.append(int(input()))
b=b+l
l.reverse()
for num1, num2 in zip(l, b):
	prod.append(num1 * num2)
print(sum(prod))


n, k = map(int, input().split())
diff = n - 1
current = 1
print(current, end = " ")
for i in range(k - 1):
    current += ((-1) ** (i % 2)) * diff
    diff -= 1
    print(current, end = " ")
for i in range(n - k):
    current += ((-1) ** ((k + 1) % 2))
    print(current, end = " " )
print()


using System;
using System.Text;
 class Program
    {
        static void Main(string[] args)
        {
            int n, k;
            {
                string[] input = Console.In.ReadLine().Split(new char[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries);
                n = int.Parse(input[0]);
                k = int.Parse(input[1])-1;
            }
            StringBuilder resultery = new StringBuilder();
            int min = 1, max = n;
            int i = 1;
            for(; k>0; --k, ++i)
            {
                if (i % 2 == 1) resultery.Append(min++);
                else resultery.Append(max--);
                resultery.Append(' ');
            }
            if (min != max) Writer(resultery, i, min, max);
            Console.WriteLine(resultery.ToString(0, resultery.Length - 1));
        }

        static void Writer(StringBuilder builder, int reverse, int start, int end)
        {
            if(reverse%2==1)
            {
                for (; start <= end;)
                { builder.Append(start++); builder.Append(' '); }
            }
            else
            {
                for (; start <= end;)
                { builder.Append(end--); builder.Append(' '); }
            }
        }
    }


using System;
using System.Collections.Generic;
using System.Linq;
using Solver.Ex;
using Debug = System.Diagnostics.Debug;
using Watch = System.Diagnostics.Stopwatch;
using StringBuilder = System.Text.StringBuilder;
namespace Solver
{
    public class Solver
    {
        public void Solve()
        {
            var n = sc.Integer();
            var k = sc.Integer();
            var e = Enumerable.Range(1, n).ToArray();
            var tmp = e[n - k];
            e[n - k] = e[n - 1];
            e[n - 1] = tmp;
            var t = 0;
            k--;
            for (int i = n - k; i < n; i++)
            {
                e[i] = e[i - 1];
                if (t == 0)
                    e[i] -= k;
                else e[i] += k;
                k--;
                t ^= 1;
            }
            IO.Printer.Out.WriteLine(e.AsJoinedString());

        }

        internal IO.StreamScanner sc;
    }

    #region Main and Settings
    static class Program
    {
        static void Main(string[] arg)
        {
#if DEBUG
            var errStream = new System.IO.FileStream(@"..\..\dbg.out", System.IO.FileMode.Create, System.IO.FileAccess.Write, System.IO.FileShare.ReadWrite);
            Debug.Listeners.Add(new System.Diagnostics.TextWriterTraceListener(errStream, "debugStream"));
            Debug.AutoFlush = false;
            var sw = new Watch(); sw.Start();
            try
            {
#endif
                var solver = new Solver();
                solver.sc = new IO.StreamScanner(Console.OpenStandardInput());
                solver.Solve();
                IO.Printer.Out.Flush();
#if DEBUG
            }
            catch (Exception ex)
            {
                Console.Error.WriteLine(ex.Message);
                Console.Error.WriteLine(ex.StackTrace);
            }
            finally
            {
                sw.Stop();
                Console.ForegroundColor = ConsoleColor.Green;
                Console.Error.WriteLine("Time:{0}ms", sw.ElapsedMilliseconds);
                Debug.Close();
                System.Threading.Thread.Sleep(System.Threading.Timeout.Infinite);
            }
#endif
        }

    }
    #endregion
}
#region IO Helper
namespace Solver.IO
{
    public class Printer : System.IO.StreamWriter
    {
        static Printer() { Out = new Printer(Console.OpenStandardOutput()) { AutoFlush = false }; }
        public static Printer Out { get; set; }
        public override IFormatProvider FormatProvider { get { return System.Globalization.CultureInfo.InvariantCulture; } }
        public Printer(System.IO.Stream stream) : base(stream, new System.Text.UTF8Encoding(false, true)) { }
        public Printer(System.IO.Stream stream, System.Text.Encoding encoding) : base(stream, encoding) { }
        public void Write<T>(string format, IEnumerable<T> source) { Write(format, source.OfType<object>().ToArray()); }
        public void WriteLine<T>(string format, IEnumerable<T> source) { WriteLine(format, source.OfType<object>().ToArray()); }
    }
    public class StreamScanner
    {
        public StreamScanner(System.IO.Stream stream) { iStream = stream; }
        private readonly System.IO.Stream iStream;
        private readonly byte[] buf = new byte[1024];
        private int len, ptr;
        private bool eof = false;
        public bool IsEndOfStream { get { return eof; } }
        const byte lb = 33, ub = 126, el = 10, cr = 13;
        public byte read()
        {
            if (eof) throw new System.IO.EndOfStreamException();
            if (ptr >= len) { ptr = 0; if ((len = iStream.Read(buf, 0, 1024)) <= 0) { eof = true; return 0; } }
            return buf[ptr++];
        }
        public char Char() { byte b = 0; do b = read(); while (b < lb || ub < b);            return (char)b; }
        public char[] Char(int n) { var a = new char[n]; for (int i = 0; i < n; i++) a[i] = Char(); return a; }
        public char[][] Char(int n, int m) { var a = new char[n][]; for (int i = 0; i < n; i++) a[i] = Char(m); return a; }
        public string Scan()
        {
            if (eof) throw new System.IO.EndOfStreamException();
            StringBuilder sb = null;
            var enc = System.Text.UTF8Encoding.Default;
            do
            {
                for (; ptr < len && (buf[ptr] < lb || ub < buf[ptr]); ptr++) ;
                if (ptr < len) break;
                ptr = 0;
                if ((len = iStream.Read(buf, 0, 1024)) <= 0) { eof = true; return ""; }
            } while (true);
            do
            {
                var f = ptr;
                for (; ptr < len; ptr++)
                    if (buf[ptr] < lb || ub < buf[ptr])
                    //if(buf[i]==cr||buf[i]==el)
                    {
                        string s;
                        if (sb == null) s = enc.GetString(buf, f, ptr - f);
                        else { sb.Append(enc.GetChars(buf, f, ptr - f)); s = sb.ToString(); }
                        ptr++; return s;
                    }
                if (sb == null) sb = new StringBuilder(enc.GetString(buf, f, len - f));
                else sb.Append(enc.GetChars(buf, ptr, len - ptr));
                ptr = 0;

            }
            while (!eof && (len = iStream.Read(buf, 0, 1024)) > 0);
            eof = true; return (sb != null) ? sb.ToString() : "";
        }
        public long Long()
        {
            long ret = 0; byte b = 0; bool isMynus = false;
            const byte zr = 48, nn = 57, my = 45;
            do b = read();
            while (b != my && (b < zr || nn < b));
            if (b == my) { isMynus = true; b = read(); }
            for (; true; b = read())
                if (b < zr || nn < b)
                    return isMynus ? -ret : ret;
                else ret = ret * 10 + b - zr;
        }
        public int Integer()
        {
            int ret = 0; byte b = 0; bool isMynus = false;
            const byte zr = 48, nn = 57, my = 45;
            do b = read();
            while (b != my && (b < zr || nn < b));
            if (b == my) { isMynus = true; b = read(); }
            for (; true; b = read())
                if (b < zr || nn < b)
                    return isMynus ? -ret : ret;
                else ret = ret * 10 + b - zr;
        }
        public double Double() { return double.Parse(Scan(), System.Globalization.CultureInfo.InvariantCulture); }
        public string[] Scan(int n) { var a = new string[n]; for (int i = 0; i < n; i++) a[i] = Scan(); return a; }
        public double[] Double(int n) { var a = new double[n]; for (int i = 0; i < n; i++) a[i] = Double(); return a; }
        public int[] Integer(int n) { var a = new int[n]; for (int i = 0; i < n; i++) a[i] = Integer(); return a; }
        public long[] Long(int n) { var a = new long[n]; for (int i = 0; i < n; i++)a[i] = Long(); return a; }
        public void Flush() { iStream.Flush(); }
    }
}
#endregion
#region Extension
namespace Solver.Ex
{
    static public partial class EnumerableEx
    {
        static public string AsString(this IEnumerable<char> ie) { return new string(ie.ToArray()); }
        static public string AsJoinedString<T>(this IEnumerable<T> ie, string st = " ") { return string.Join(st, ie); }
        static public T[] Enumerate<T>(this int n, Func<int, T> f) { var a = new T[n]; for (int i = 0; i < n; i++) a[i] = f(i); return a; }
    }
}
#endregion


using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Globalization;

namespace ConsoleApplication25
{
    class Program
    {
        static void Main(string[] args)
        {
            var init = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();

            var n = init[0];
            var k = init[1];

            var sb = new StringBuilder();
            var initN = 1;
            sb.Append(initN + " ");

            while (k > 1)
            {
                initN = initN + k;
                sb.Append(initN + " ");
                k--;
            }

            for (int i = 2; i <= n;i++)
            {
                if (!sb.ToString().Contains(i.ToString()))
                {
                    sb.Append(i + " ");
                }
            }

                Console.WriteLine(sb.ToString());
                Console.ReadLine();
        }

    }
}


using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Globalization;

namespace ConsoleApplication25
{
    class Program
    {
        static void Main(string[] args)
        {
            var init = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();

            var n = init[0];
            var k = init[1];

            var sb = new StringBuilder();
            var nums = new int[n];
            var n1 = 1;
            var n2 = 10;

            for (int i = 0; i < n; i++)
            {
                if (i % 2 == 0)
                {
                    nums[i] = n1;
                    n1++;
                }
                else
                {
                    nums[i] = n2;
                    n2--;
                }
            }

            int[] arr = new int[n - k];

            Array.Copy(nums, k, arr, 0, n - k);
            Array.Sort(arr);

            for (int i = 0; i < k; i++)
            {
                Console.Write(nums[i] + " ");
            }

            foreach(int i in arr)
            {
                Console.Write(i + " ");
            }
                Console.ReadLine();
        }

    }
}


using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Globalization;

namespace ConsoleApplication25
{
    class Program
    {
        static void Main(string[] args)
        {
            var init = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();

            var n = init[0];
            var k = init[1];

            var a = new int[n];
            int l = 1, r = n;
            int i;
            for (i = 0; i < n && k > 0; i++, k--)
            {
                if (i % 2 == 0)
                    a[i] = l++;
                else
                    a[i] = r--;
            }
            if (i % 2 == 1)
                for (; i < n; i++)
                    a[i] = a[i - 1] + 1;
            else
                for (; i < n; i++)
                    a[i] = a[i - 1] - 1;

            foreach (int nums in a )
            {
                Console.Write(nums + " ");
            }
                Console.ReadLine();
        }

    }
}


using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Globalization;

namespace ConsoleApplication25
{
    class Program
    {
        static void Main(string[] args)
        {
            var init = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();

            var n = init[0];
            var k = init[1];

            var sb = new StringBuilder();
            var nums = new int[n];
            var n1 = 1;
            var n2 = n;

            for (int i = 0; i < n; i++)
            {
                if (i % 2 == 0)
                {
                    nums[i] = n1;
                    n1++;
                }
                else
                {
                    nums[i] = n2;
                    n2--;
                }
            }

            int[] arr = new int[n - k];

            Array.Copy(nums, k, arr, 0, n - k);
            Array.Sort(arr);

            for (int i = 0; i < k; i++)
            {
                Console.Write(nums[i] + " ");
            }

            foreach(int i in arr)
            {
                Console.Write(i + " ");
            }
                Console.ReadLine();
        }

    }
}


using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Globalization;

namespace ConsoleApplication25
{
    class Program
    {
        static void Main(string[] args)
        {
            var init = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();

            var n = init[0];
            var k = init[1];

            var sb = new StringBuilder();
            var initN = 1;
            sb.Append(initN + " ");

            while (k > 1)
            {
                initN = (initN + k) > n ? initN - k : initN + k;
                sb.Append(initN + " ");
                k--;
            }

            for (int i = 2; i <= n;i++)
            {
                if (!sb.ToString().Contains(i.ToString()))
                {
                    sb.Append(i + " ");
                }
            }

                Console.WriteLine(sb.ToString());
                Console.ReadLine();
        }

    }
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Diverse_Permutation
{
    class Program
    {
        static void Main(string[] args)
        {
            string str_Inputs = Console.ReadLine();
            string[] arr_Inputs = str_Inputs.Split(' ');
            int num_N = Convert.ToInt32(arr_Inputs[0]);
            int num_K = Convert.ToInt32(arr_Inputs[1]);
            int num_low = 1, num_high;

            while (num_N >= num_K + 1)
            {
                Console.Write((num_N--)+" ");
            }

            num_high = num_N;

            while (num_low < num_high)
            {
                Console.Write(num_low + " " + num_high + " ");
                num_low++; num_high--;
            }

            if (num_low == num_high)
            {
                Console.Write(num_low);
            }

            Console.ReadLine();
        }
    }
}


using System;
using System.IO;
using System.Text;

namespace Diverse_Permutation
{
    internal class Program
    {
        private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);
        private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);

        private static void Main(string[] args)
        {
            int n = Next();
            int k = Next();

                int i1 = 1;
                int i2 = n;
                int count = -1;
                k--;
                for (int i = 0; i < n; i++)
                {
                    writer.Write(i1++);
                    writer.Write(' ');
                    count++;
                    i++;
                    if (count == k)
                    {
                        count = -1;
                        break;

                    }
                    if (i == n)
                        break;
                    writer.Write(i2--);
                    writer.Write(' ');
                    count++;
                    if (count == k)
                    {
                        break;
                    }
                }
                if (count == -1)
                {
                    for (int i = i1; i <= i2; i++)
                    {
                        writer.Write(i);
                        writer.Write(' ');
                    }
                }
                else
                {
                    for (int i = i2; i >= i1; i--)
                    {
                        writer.Write(i);
                        writer.Write(' ');
                    }
                }

            writer.Flush();
        }

        private static int Next()
        {
            int c;
            int res = 0;
            do
            {
                c = reader.Read();
                if (c == -1)
                    return res;
            } while (c < '0' || c > '9');
            res = c - '0';
            while (true)
            {
                c = reader.Read();
                if (c < '0' || c > '9')
                    return res;
                res *= 10;
                res += c - '0';
            }
        }
    }
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Diverse_Permutation
{
    class Program
    {
        static void Main(string[] args)
        {
            string strInput = Console.ReadLine();
            string[] arInputs = strInput.Split(' ');

            int nN = Convert.ToInt32(arInputs[0]);
            int nDistinct = Convert.ToInt32(arInputs[1]);

            if (1 < nN && 1 <= nDistinct)
            {
                if (1 == nDistinct)
                {
                    for (int nStart = 1; nStart <= nN; nStart++)
                    {
                        Console.Write(nStart + " ");
                    }
                }
                else
                {
                    int[] Values = new int[nN];
                    for (int nStart = 1; nStart <= nN; nStart++)
                    {
                        Values[nStart - 1] = nStart;
                    }

                    int nOffset = 2;
                    int nCheckIndex = 0;
                    bool bIsSuccess = true;
                    for (int nRepeat = 1; nRepeat < nDistinct; nRepeat ++)
                    {
                        int nWantValue = Values[nCheckIndex] + nOffset;
                        if (nN <= nWantValue - 1) { bIsSuccess = false; break; }

                        int nTemp = Values[nWantValue - 1];
                        Values[nWantValue - 1] = Values[nCheckIndex + 1];
                        Values[nCheckIndex + 1] = nTemp;
                        nCheckIndex = nWantValue - 1;
                        nOffset++;
                    }

                    if (true == bIsSuccess)
                    {
                        for (int nStart = 0; nStart < Values.Length; nStart++)
                        {
                            Console.Write(Values[nStart] + " ");
                        }
                    }
                }
            }

            Console.ReadLine();
        }
    }
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Diverse_Permutation
{
    class Program
    {
        static void Main(string[] args)
        {
            string strInput = Console.ReadLine();
            string[] arInputs = strInput.Split(' ');

            int nN = Convert.ToInt32(arInputs[0]);
            int nDistinct = Convert.ToInt32(arInputs[1]);

            if (1 < nN && 1 <= nDistinct && nDistinct < nN)
            {
                if (1 == nDistinct)
                {
                    for (int nStart = 1; nStart <= nN; nStart++)
                    {
                        Console.Write(nStart + " ");
                    }
                }
                else
                {
                    List<Int32> Values = new List<int>();
                    for (int nStart = 1; nStart <= nN; nStart++)
                    {
                        Values.Add(nStart);
                    }

                    int nCriterionIndex = 0;
                    int nCurrentDistinct = nDistinct;

                    for (int nRepeat = 1; nRepeat < nDistinct; nRepeat++)
                    {
                        int nWannaFindValue;
                        if (nRepeat % 2 == 0)
                        {
                            nWannaFindValue = Values[nCriterionIndex] - nCurrentDistinct;
                        }
                        else
                        {
                            nWannaFindValue = Values[nCriterionIndex] + nCurrentDistinct;
                        }

                        int nIndex = Values.IndexOf(nWannaFindValue);

                        int nTemp = Values[nCriterionIndex + 1];
                        Values[nCriterionIndex + 1] = Values[nIndex];
                        Values[nIndex] = nTemp;

                        nCriterionIndex++;
                        nCurrentDistinct--;
                    }

                    foreach (int val in Values)
                    {
                        Console.Write(val + " ");
                    }
                }
            }

            Console.ReadLine();
        }
    }
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Diverse_Permutation
{
    class Program
    {
        static void Main(string[] args)
        {
            string strInput = Console.ReadLine();
            string[] arInputs = strInput.Split(' ');

            int nN = Convert.ToInt32(arInputs[0]);
            int nK = Convert.ToInt32(arInputs[1]);

            int nOutput = 1;
            int nOffset = nK;

            Console.Write(nOutput + " ");

            for (int nRepeat = 1; nRepeat <= nK; nRepeat++)
            {
                if (0 != nRepeat % 2)
                {
                    nOutput = nOutput + nOffset;
                }
                else
                {
                    nOutput = nOutput - nOffset;
                }

                Console.Write(nOutput + " ");
                nOffset--;
            }

            for (int nRepeat = nK + 2; nRepeat <= nN; nRepeat++)
            {
                Console.Write(nRepeat + " ");
            }

            Console.ReadLine();
        }
    }
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Diverse_Permutation
{
    class Program
    {
        static void Main(string[] args)
        {
            string strInput = Console.ReadLine();
            string[] arInputs = strInput.Split(' ');

            int nN = Convert.ToInt32(arInputs[0]);
            int nDistinct = Convert.ToInt32(arInputs[1]);

            if (1 < nN && 1 <= nDistinct)
            {
                if (1 == nDistinct)
                {
                    for (int nStart = 1; nStart <= nN; nStart++)
                    {
                        Console.Write(nStart + " ");
                    }
                }
                else
                {
                    int[] Values = new int[nN];
                    for (int nStart = 1; nStart <= nN; nStart++)
                    {
                        Values[nStart - 1] = nStart;
                    }

                    int nOffset = 2;
                    int nCheckIndex = 0;
                    bool bIsSuccess = true;
                    for (int nRepeat = 1; nRepeat < nDistinct; nRepeat ++)
                    {
                        int nWantValue = Values[nCheckIndex] + nOffset;
                        if (nN <= nWantValue - 1) { bIsSuccess = false; break; }
                        if (nN == nWantValue && nRepeat + 1 != nDistinct) { bIsSuccess = false; break; }
                        int nTemp = Values[nWantValue - 1];
                        Values[nWantValue - 1] = Values[nCheckIndex + 1];
                        Values[nCheckIndex + 1] = nTemp;
                        nCheckIndex = nWantValue - 1;
                        nOffset++;
                    }

                    if (true == bIsSuccess)
                    {
                        for (int nStart = 0; nStart < Values.Length; nStart++)
                        {
                            Console.Write(Values[nStart] + " ");
                        }
                    }
                }
            }

            Console.ReadLine();
        }
    }
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Diverse_Permutation
{
    class Program
    {
        static void Main(string[] args)
        {
            string strInput = Console.ReadLine();
            string[] arInputs = strInput.Split(' ');

            int nN = Convert.ToInt32(arInputs[0]);
            int nDistinct = Convert.ToInt32(arInputs[1]);

            if (1 < nN && 1 <= nDistinct && nDistinct < nN)
            {
                if (1 == nDistinct)
                {
                    for (int nStart = 1; nStart <= nN; nStart++)
                    {
                        Console.Write(nStart + " ");
                    }
                }
                else
                {
                    List<Int32> Values = new List<int>();
                    for (int nStart = 1; nStart <= nN; nStart++)
                    {
                        Values.Add(nStart);
                    }

                    int nCriterionIndex = 0;
                    int nCurrentDistinct = nDistinct;
                    Console.Write(Values[0] + " ");

                    for (int nRepeat = 1; nRepeat < nDistinct; nRepeat++)
                    {
                        int nWannaFindValue;
                        if (nRepeat % 2 == 0)
                        {
                            nWannaFindValue = Values[nCriterionIndex] - nCurrentDistinct;
                        }
                        else
                        {
                            nWannaFindValue = Values[nCriterionIndex] + nCurrentDistinct;
                        }

                        int nIndex = Values.IndexOf(nWannaFindValue);

                        int nTemp = Values[nCriterionIndex + 1];
                        Values[nCriterionIndex + 1] = Values[nIndex];
                        Values[nIndex] = nTemp;

                        nCriterionIndex++;
                        nCurrentDistinct--;
                        Console.Write(Values[nRepeat] + " ");
                    }

                    for (int nStart = nDistinct; nStart < nN; nStart++ )
                        Console.Write(Values[nStart] + " ");
                }
            }

            Console.ReadLine();
        }
    }
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Text.RegularExpressions;
using System.IO;
using System.Numerics;
using System.Globalization;
using System.Threading;

namespace probleme {
    class Program {
        static void Main(string[] args) {
            //Console.SetIn(new StreamReader("file.txt"));
            string[] s = Console.ReadLine().Split(' ');
            int n = int.Parse(s[0]), k = int.Parse(s[1]);
            int st = 1, dr = n;
            int[] v = new int[n];
            for (int i = 0; i < k; i++) {
                if (i % 2 == 0) {
                    v[i] = st;
                    st++;
                } else {
                    v[i] = dr;
                    dr--;
                }
            }
            if (k % 2 == 0) {
                for (int i = k; i < n; i++) {
                    v[i] = dr;
                    dr--;
                }
            } else {
                for (int i = k; i < n; i++) {
                    v[i] = st;
                    st++;
                }
            }
            for (int i = 0; i < n; i++) {
                Console.Write("{0} ", v[i]);
            }
            //Console.ReadKey();
        }
    }
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Codeforces
{

    class Program
    {
        static void Main(string[] args)
        {
            Solve();
        }

        static void Solve()
        {
            var _ = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
            int n = _[0];
            int k = _[1];

            int[] res = new int[n];

            int start = k / 2 + 1;
            int dir = k % 2 * 2 - 1;
            for (int i = 0; i < k; i++)
            {
                res[i] = start;
                start += dir;
                dir = dir > 0 ? -dir - 1 : -dir + 1;
            }

            for (; start <= n; start++)
                res[start - 1] = start;

            Console.WriteLine(string.Join(" ", res));
        }

    }
}


using System;
using System.Collections.Generic;
using System.IO;

namespace prA {

    class Program {
#if ONLINE_JUDGE
        private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024 * 10), System.Text.Encoding.ASCII, false, 1024 * 10);
        private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), System.Text.Encoding.ASCII, 1024 * 10);
#else
        private static readonly StreamWriter writer = new StreamWriter("output");
        private static readonly StreamReader reader = new StreamReader("input");
#endif
        static void Main(string[] args) {
            int n = Next();
            int k = Next();
            for(int i = 0; i < k; i++) {
                if(i % 2 == 0)
                    writer.Write(i / 2 + 1);
                else
                    writer.Write(n - i / 2);
                writer.Write(" ");
            }
            if(k % 2 == 0) {
                for(int i = n - k / 2; i > k / 2; i--) {
                    writer.Write(i);
                    writer.Write(' ');
                }
            }
            else {
                for(int i = k / 2 + 2; i <= n - k / 2; i++) {
                    writer.Write(i);
                    writer.Write(' ');
                }
            }

            writer.Flush();
#if !ONLINE_JUDGE
            writer.Close();
#endif
        }
        private static int Next() {
            int c;
            int res = 0;
            do {
                c = reader.Read();
                if(c == -1)
                    return res;
            } while(c != '-' && (c < '0' || c > '9'));
            int sign = 1;
            if(c == '-') {
                sign = -1;
                c = reader.Read();
            }
            res = c - '0';
            while(true) {
                c = reader.Read();
                if(c < '0' || c > '9')
                    return res * sign;
                res *= 10;
                res += c - '0';
            }
        }
    }
}


using System;
using System.Collections.Generic;
using System.IO;

namespace prA {

    class Program {
#if ONLINE_JUDGE
        private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024 * 10), System.Text.Encoding.ASCII, false, 1024 * 10);
        private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), System.Text.Encoding.ASCII, 1024 * 10);
#else
        private static readonly StreamWriter writer = new StreamWriter("output");
        private static readonly StreamReader reader = new StreamReader("input");
#endif
        static void Main(string[] args) {
            int n = Next();
            int k = Next();
            for(int i = 0; i < k / 2; i++) {
                writer.Write(i + 1);
                writer.Write(" ");
                writer.Write(n - i);
                writer.Write(" ");
            }
            for(int i = n - k / 2; i > k / 2; i--) {
                writer.Write(i);
                writer.Write(" ");
            }

            writer.Flush();
#if !ONLINE_JUDGE
            writer.Close();
#endif
        }
        private static int Next() {
            int c;
            int res = 0;
            do {
                c = reader.Read();
                if(c == -1)
                    return res;
            } while(c != '-' && (c < '0' || c > '9'));
            int sign = 1;
            if(c == '-') {
                sign = -1;
                c = reader.Read();
            }
            res = c - '0';
            while(true) {
                c = reader.Read();
                if(c < '0' || c > '9')
                    return res * sign;
                res *= 10;
                res += c - '0';
            }
        }
    }
}


using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;

// (づ°ω°)づﾐ★゜・。。・゜゜・。。・゜☆゜・。。・゜゜・。。・゜
public class Solver
{
    public object Solve()
    {
        int n = ReadInt();
        int k = ReadInt();

        var a = new int[n];
        int l = 1, r = n;
        int i;
        for (i = 0; i < n && k > 0; i++, k--)
        {
            if (i % 2 == 0)
                a[i] = l++;
            else
                a[i] = r--;
        }
        if (i % 2 == 1)
            for (; i < n; i++)
                a[i] = a[i - 1] + 1;
        else
            for (; i < n; i++)
                a[i] = a[i - 1] - 1;

        Write(a);

        return null;
    }

    #region Main

    protected static TextReader reader;
    protected static TextWriter writer;

    static void Main()
    {
#if DEBUG
        reader = new StreamReader("..\\..\\input.txt");
        writer = Console.Out;
        //writer = new StreamWriter("..\\..\\output.txt");
#else
        reader = new StreamReader(Console.OpenStandardInput());
        writer = new StreamWriter(Console.OpenStandardOutput());
        //reader = new StreamReader("exchange.in");
        //writer = new StreamWriter("exchange.out");
#endif
        try
        {
            object result = new Solver().Solve();
            if (result != null)
                writer.WriteLine(result);
        }
        catch (Exception ex)
        {
#if DEBUG
            Console.WriteLine(ex);
#else
            Console.WriteLine(ex);
            throw;
#endif
        }
        reader.Close();
        writer.Close();
    }

    #endregion

    #region Read / Write

    private static Queue<string> currentLineTokens = new Queue<string>();

    private static string[] ReadAndSplitLine()
    {
        return reader.ReadLine().Split(new[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries);
    }

    public static string ReadToken()
    {
        while (currentLineTokens.Count == 0)
            currentLineTokens = new Queue<string>(ReadAndSplitLine());
        return currentLineTokens.Dequeue();
    }

    public static int ReadInt()
    {
        return int.Parse(ReadToken());
    }

    public static long ReadLong()
    {
        return long.Parse(ReadToken());
    }

    public static double ReadDouble()
    {
        return double.Parse(ReadToken(), CultureInfo.InvariantCulture);
    }

    public static int[] ReadIntArray()
    {
        return ReadAndSplitLine().Select(int.Parse).ToArray();
    }

    public static long[] ReadLongArray()
    {
        return ReadAndSplitLine().Select(long.Parse).ToArray();
    }

    public static double[] ReadDoubleArray()
    {
        return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray();
    }

    public static int[][] ReadIntMatrix(int numberOfRows)
    {
        int[][] matrix = new int[numberOfRows][];
        for (int i = 0; i < numberOfRows; i++)
            matrix[i] = ReadIntArray();
        return matrix;
    }

    public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)
    {
        int[][] matrix = ReadIntMatrix(numberOfRows);
        int[][] ret = new int[matrix[0].Length][];
        for (int i = 0; i < ret.Length; i++)
        {
            ret[i] = new int[numberOfRows];
            for (int j = 0; j < numberOfRows; j++)
                ret[i][j] = matrix[j][i];
        }
        return ret;
    }

    public static string[] ReadLines(int quantity)
    {
        string[] lines = new string[quantity];
        for (int i = 0; i < quantity; i++)
            lines[i] = reader.ReadLine().Trim();
        return lines;
    }

    public static void WriteArray<T>(IEnumerable<T> array)
    {
        writer.WriteLine(string.Join(" ", array));
    }

    public static void Write<T>(params T[] array)
    {
        WriteArray(array);
    }

    public static void WriteLines<T>(IEnumerable<T> array)
    {
        foreach (var a in array)
            writer.WriteLine(a);
    }

    #endregion
}